keith-turner commented on code in PR #4313:
URL: https://github.com/apache/accumulo/pull/4313#discussion_r1505063501
##########
core/src/main/java/org/apache/accumulo/core/spi/compaction/CompactorGroupId.java:
##########
@@ -28,10 +31,23 @@
* @see org.apache.accumulo.core.spi.compaction
*/
public class CompactorGroupId extends AbstractId<CompactorGroupId> {
- // ELASTICITY_TODO make this cache ids like TableId. This will help save
manager memory.
private static final long serialVersionUID = 1L;
- protected CompactorGroupId(String canonical) {
+ static final Cache<String,CompactorGroupId> cache = Caches.getInstance()
+ .createNewBuilder(Caches.CacheName.COMPACTOR_GROUP_ID,
false).weakValues().build();
+
+ private CompactorGroupId(String canonical) {
super(canonical);
}
+
+ /**
+ * Get a CompactorGroupId object for the provided canonical string. This is
guaranteed to be
+ * non-null.
+ *
+ * @param canonical compactor group ID string
+ * @return CompactorGroupId object
+ */
+ public static CompactorGroupId of(String canonical) {
+ return cache.get(canonical, k -> new CompactorGroupId(canonical));
Review Comment:
```suggestion
return cache.get(canonical, CompactorGroupId::new);
```
--
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]