in curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java [695:742]
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) // scaffolding to test CURATOR-525
{
if (debugCheckBackgroundRetryReadyLatch != null) {
debugCheckBackgroundRetryReadyLatch.countDown();
}
try {
debugCheckBackgroundRetryLatch.await();
if (injectedCode != null) {
code = injectedCode;
}
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
validateConnection(FrameworkUtils.codeToState(code));
logError("Background operation retry gave up", e);
}
return doRetry;
}