kezhuw commented on code in PR #453:
URL: https://github.com/apache/curator/pull/453#discussion_r1155140954
##########
curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java:
##########
@@ -770,14 +790,24 @@ static <T> void backgroundCreateParentsThenNode(final
CuratorFrameworkImpl clien
@Override
public void performBackgroundOperation(OperationAndData<T> dummy)
throws Exception
{
+ AtomicReference<CuratorEvent> event = new AtomicReference<>();
+ AsyncCallback.Create2Callback callback = new
AsyncCallback.Create2Callback()
+ {
+ @Override
+ public void processResult(int rc, String path, Object ctx,
String name, Stat stat)
+ {
+ event.set(createResponseEvent(client, rc, path, ctx,
name, stat));
+ }
+ };
try
{
- ZKPaths.mkdirs(client.getZooKeeper(), path, false,
aclProvider, createParentsAsContainers);
+ ZKPaths.mkdirs(client.getZooKeeper(), path, false,
aclProvider, createParentsAsContainers, callback);
}
catch ( KeeperException e )
{
if (
!client.getZookeeperClient().getRetryPolicy().allowRetry(e) )
{
+
client.processBackgroundOperation(mainOperationAndData, event.get());
Review Comment:
Sounds like all we need in exceptional case is `rc` and `path`.
`KeeperException` already covers these two `KeeperException::code` and
`KeeperException::getPath`. So I think we could construct `CuratorEvent`
without resorting to a callback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]