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


##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -1068,17 +1073,12 @@ boolean canSuspendTablets() {
     }
 
     try {
-      final AgeOffStore<Manager> store = new AgeOffStore<>(
-          new org.apache.accumulo.core.fate.ZooStore<>(getZooKeeperRoot() + 
Constants.ZFATE,
-              context.getZooReaderWriter()),
-          HOURS.toMillis(8), System::currentTimeMillis);
+      initializeFateInstance(context, FateInstanceType.META,
+          new ZooStore<>(getZooKeeperRoot() + Constants.ZFATE, 
context.getZooReaderWriter()));
+      initializeFateInstance(context, FateInstanceType.USER,
+          new AccumuloStore<>(context, FateTable.NAME));

Review Comment:
   After these are setup, the map never changes.  Could use an immutable map 
like the following.
   
   ```suggestion
        var metaInstance = initializeFateInstance(context, 
FateInstanceType.META,
             new ZooStore<>(getZooKeeperRoot() + Constants.ZFATE, 
context.getZooReaderWriter()));
         var userInstance = initializeFateInstance(context, 
FateInstanceType.USER,
             new AccumuloStore<>(context, FateTable.NAME));
             
          fateRefs = Map.of(FateInstanceType.META, metaInstance, 
FateInstanceType.USER, userInstance);
   ```
   
   and change the declaration of fateRefs to
   
   ```java
    private volatile Map<FateInstanceType,Fate<Manager>> fateRefs = Map.of();
   ```
   
   One downside of this that variable can not be final anymore.  An upside is 
its nice having the map be immutable when its never expected to change.



-- 
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