Github user dragonsinth commented on a diff in the pull request:
https://github.com/apache/curator/pull/23#discussion_r15483096
--- Diff:
curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
---
@@ -722,39 +725,35 @@ public void retriesExhausted(OperationAndData<String>
operationAndData)
private <DATA_TYPE> void
handleBackgroundOperationException(OperationAndData<DATA_TYPE>
operationAndData, Throwable e)
{
- do
+ if ( (operationAndData != null) && RetryLoop.isRetryException(e) )
{
- if ( (operationAndData != null) &&
RetryLoop.isRetryException(e) )
+ if (
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
+ {
+ log.debug("Retry-able exception received", e);
+ }
+ if (
client.getRetryPolicy().allowRetry(operationAndData.getThenIncrementRetryCount(),
operationAndData.getElapsedTimeMs(), operationAndData) )
{
if (
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
{
- log.debug("Retry-able exception received", e);
+ log.debug("Retrying operation");
}
- if (
client.getRetryPolicy().allowRetry(operationAndData.getThenIncrementRetryCount(),
operationAndData.getElapsedTimeMs(), operationAndData) )
+ backgroundOperations.offer(operationAndData);
+ return;
+ }
+ else
+ {
+ if (
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
{
- if (
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
- {
- log.debug("Retrying operation");
- }
- backgroundOperations.offer(operationAndData);
- break;
+ log.debug("Retry policy did not allow retry");
}
- else
+ if ( operationAndData.getErrorCallback() != null )
{
- if (
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
- {
- log.debug("Retry policy did not allow retry");
- }
- if ( operationAndData.getErrorCallback() != null )
- {
-
operationAndData.getErrorCallback().retriesExhausted(operationAndData);
- }
+
operationAndData.getErrorCallback().retriesExhausted(operationAndData);
}
}
-
- logError("Background exception was not retry-able or retry
gave up", e);
}
- while ( false );
+
+ logError("Background exception was not retry-able or retry gave
up", e);
--- End diff --
This is unrelated to the main change. While I was in here, I noticed this
method was more complicated than it needed to be. I could revert this section
if you guys would prefer to isolate changes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---