keith-turner commented on code in PR #5744:
URL: https://github.com/apache/accumulo/pull/5744#discussion_r2214373177


##########
core/src/main/java/org/apache/accumulo/core/data/ResourceGroupId.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.data;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.util.cache.Caches;
+import org.apache.accumulo.core.util.cache.Caches.CacheName;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class ResourceGroupId extends AbstractId<ResourceGroupId> {
+
+  // cache is for canonicalization/deduplication of created objects,
+  // to limit the number of TableId objects in the JVM at any given moment

Review Comment:
   copy paste issue, mentions TableId



##########
core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java:
##########
@@ -222,7 +222,7 @@ public String getAddress() {
 
                 @Override
                 public String getGroup() {
-                  return entry.getResourceGroup();
+                  return entry.getResourceGroup().canonical();

Review Comment:
   was the return type of this method not changed because its SPI?  We can 
change SPI w/o deprecation cycle if we want to.  Using a narrow type instead of 
string is so much nicer.



##########
core/src/main/java/org/apache/accumulo/core/data/ResourceGroupId.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.data;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.util.cache.Caches;
+import org.apache.accumulo.core.util.cache.Caches.CacheName;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class ResourceGroupId extends AbstractId<ResourceGroupId> {
+
+  // cache is for canonicalization/deduplication of created objects,
+  // to limit the number of TableId objects in the JVM at any given moment
+  // WeakReferences are used because we don't need them to stick around any 
longer than they need to
+  static final Cache<String,ResourceGroupId> cache = Caches.getInstance()
+      .createNewBuilder(CacheName.RESOURCE_GROUP_ID, 
false).weakValues().build();
+
+  public static final ResourceGroupId DEFAULT =
+      ResourceGroupId.of(Constants.DEFAULT_RESOURCE_GROUP_NAME);
+
+  private static final long serialVersionUID = 1L;
+
+  private ResourceGroupId(String canonical) {
+    super(canonical);

Review Comment:
   Noticed we can create ids using empty string.  Seem like it could be 
troublesome to have a RG that is empty string.  Wonder if we should error for 
that case (maybe blank too).  Also wondering if other ids should have that 
restriction.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to