dlmarion commented on PR #2967:
URL: https://github.com/apache/accumulo/pull/2967#issuecomment-1263940521

   I was thinking of something like:
   
   ```
    public Future<Void> modifyProperties(final Consumer<Map<String,String>> 
mapMutator)
        throws AccumuloException, AccumuloSecurityException, 
IllegalArgumentException {
   
      final Retry retry =
          Retry.builder().infiniteRetries().retryAfter(25, 
MILLISECONDS).incrementBy(25, MILLISECONDS)
          .maxWait(30, SECONDS).backOffFactor(1.5).logInterval(3, 
MINUTES).createRetry();
   
      FutureTask<Void> f = new FutureTask<>(() -> {
        while (true) {
          try {
            tryToModifyProperties(mapMutator);
            break;
          } catch (ConcurrentModificationException cme) {
            try {
              
retry.logRetry(LoggerFactory.getLogger(InstanceOperationsImpl.class),
                  "Unable to modify instance properties for because of 
concurrent modification");
              retry.waitForNextAttempt();
            } catch (InterruptedException e) {
              throw new RuntimeException(e);
            }
          } finally {
            retry.useRetry();
          }
        }
      }, null);
      
      ForkJoinPool.commonPool().execute(f);
      
      return f;
    }
   ```
   
   Whether or not the ForkJoinPool is used or not doesn't really matter to me. 
Other places in the client code where `ClientContext.threadPools()` is used an 
ExecutorService is created and then shutdown in the same method. I used 
ForkJoinPool here for convenience as we don't need a pool of Threads.


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