afterincomparableyum commented on code in PR #3737:
URL: https://github.com/apache/celeborn/pull/3737#discussion_r3432963342
##########
client/src/main/java/org/apache/celeborn/client/ShuffleClient.java:
##########
@@ -102,12 +104,24 @@ public static ShuffleClient get(
_instance = new ShuffleClientImpl(appUniqueId, conf, userIdentifier);
_instance.setupLifecycleManagerRef(driverHost, port);
_instance.setExtension(extension);
+ _appUniqueId = appUniqueId;
initialized = true;
} else if (!initialized) {
_instance.shutdown();
_instance = new ShuffleClientImpl(appUniqueId, conf, userIdentifier);
_instance.setupLifecycleManagerRef(driverHost, port);
_instance.setExtension(extension);
+ _appUniqueId = appUniqueId;
+ initialized = true;
+ } else if (!appUniqueId.equals(_appUniqueId)) {
+ ShuffleClientImpl newInstance = new ShuffleClientImpl(appUniqueId,
conf, userIdentifier);
+ newInstance.setupLifecycleManagerRef(driverHost, port);
+ newInstance.setExtension(extension);
+ // Publish _instance before _appUniqueId. The outer guard reads both
volatiles without
+ // holding the lock, so writing _appUniqueId first would let another
thread observe the
+ // new id while _instance is still stale and return the old instance.
+ _instance = newInstance;
+ _appUniqueId = appUniqueId;
initialized = true;
}
}
Review Comment:
prefer to keep the branches separate actually, the only difference being
shutdown isn't quite accurate.
--
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]