예제 #1
0
  private void backgroundOperationsLoop() {
    AuthInfo auth = authInfo.getAndSet(null);
    if (auth != null) {
      try {
        client.getZooKeeper().addAuthInfo(auth.scheme, auth.auth);
      } catch (Exception e) {
        logError("addAuthInfo for background operation threw exception", e);
        return;
      }
    }

    while (!Thread.interrupted()) {
      OperationAndData<?> operationAndData;
      try {
        operationAndData = backgroundOperations.take();
        if (debugListener != null) {
          debugListener.listen(operationAndData);
        }
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        break;
      }

      performBackgroundOperation(operationAndData);
    }
  }
  private void backgroundOperationsLoop() {
    while (!Thread.interrupted()) {
      OperationAndData<?> operationAndData;
      try {
        operationAndData = backgroundOperations.take();
        if (debugListener != null) {
          debugListener.listen(operationAndData);
        }
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        break;
      }

      performBackgroundOperation(operationAndData);
    }
  }