Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @VisibleForTesting
- volatile CountDownLatch debugCheckBackgroundRetryLatch;
- @VisibleForTesting
- volatile CountDownLatch debugCheckBackgroundRetryReadyLatch;
- @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
- private <DATA_TYPE> boolean checkBackgroundRetry(OperationAndData<DATA_TYPE> operationAndData, CuratorEvent event)
- {
- boolean doRetry = false;
- if ( client.getRetryPolicy().allowRetry(operationAndData.getThenIncrementRetryCount(), operationAndData.getElapsedTimeMs(), operationAndData) )
- {
- doRetry = true;
- }
- else
- {
- if ( operationAndData.getErrorCallback() != null )
- {
- operationAndData.getErrorCallback().retriesExhausted(operationAndData);
- }
- if ( operationAndData.getCallback() != null )
- {
- sendToBackgroundCallback(operationAndData, event);
- }
- KeeperException.Code code = KeeperException.Code.get(event.getResultCode());
- Exception e = null;
- try
- {
- e = (code != null) ? KeeperException.create(code) : null;
- }
- catch ( Throwable t )
- {
- ThreadUtils.checkInterrupted(t);
- }
- if ( e == null )
- {
- e = new Exception("Unknown result codegetResultCode()");
- }
- if ( debugCheckBackgroundRetryLatch != null )
- {
- if ( debugCheckBackgroundRetryReadyLatch != null )
- {
- debugCheckBackgroundRetryReadyLatch.countDown();
- }
- try
- {
- debugCheckBackgroundRetryLatch.await();
- }
- catch ( InterruptedException ex )
- {
- Thread.currentThread().interrupt();
- }
- }
- validateConnection(codeToState(code));
- logError("Background operation retry gave up", e);
- }
- return doRetry;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement