Github user Randgalt commented on a diff in the pull request:
https://github.com/apache/curator/pull/35#discussion_r16055156
--- Diff:
curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
---
@@ -469,6 +469,26 @@ private String protectedPathInForeground(String
adjustedPath, byte[] data) throw
}
throw e;
}
+ catch ( KeeperException e )
+ {
+ throw e;
+ }
+ catch ( Exception e )
+ {
+ if ( protectedId != null )
+ {
+ /*
+ * CURATOR-79 - Handle an runtime exception's here and
treat the
+ * same as a connection loss exception. This is necessary
as, from
+ * the clients point of view, an exception has been thrown
and the
+ * zNode should not exist on ZK. This was causing deadlock
in the
+ * locking recipes.
+ */
+ findAndDeleteProtectedNodeInBackground(adjustedPath,
protectedId, null);
+ protectedId = UUID.randomUUID().toString();
--- End diff --
It can't be reversed. If it were reversed, the wrong ID would be passed.
Maybe for clarity, a localProtectedId can be assigned and passed to
findAndDeleteProtectedNodeInBackground()
---
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.
---