Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/242#discussion_r153252872
  
    --- Diff: 
curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 ---
    @@ -973,6 +981,33 @@ void performBackgroundOperation(OperationAndData<?> 
operationAndData)
             }
         }
     
    +    @VisibleForTesting
    +    volatile long sleepAndQueueOperationSeconds = 1;
    +
    +    private void sleepAndQueueOperation(OperationAndData<?> 
operationAndData) throws InterruptedException
    +    {
    +        operationAndData.sleepFor(sleepAndQueueOperationSeconds, 
TimeUnit.SECONDS);
    +        if ( queueOperation(operationAndData) )
    +        {
    +            forcedSleepOperations.add(operationAndData);
    +        }
    +    }
    +
    +    private void unSleepBackgroundOperations()
    +    {
    +        Collection<OperationAndData<?>> drain = new 
ArrayList<>(forcedSleepOperations.size());
    +        forcedSleepOperations.drainTo(drain);
    +        log.debug("Clearing sleep for {} operations", drain.size());
    +        for ( OperationAndData<?> operation : drain )
    +        {
    +            operation.clearSleep();
    +            if ( backgroundOperations.remove(operation) )
    --- End diff --
    
    Why do we need to reinsert all of the operations? Isn't clearing the sleep 
enough?


---

Reply via email to