narendly commented on a change in pull request #642: Fix zk session race
condition before creating a live instance
URL: https://github.com/apache/helix/pull/642#discussion_r353579362
##########
File path:
helix-core/src/main/java/org/apache/helix/manager/zk/zookeeper/ZkClient.java
##########
@@ -858,21 +931,30 @@ private void reconnect() {
}
}
- private void fireNewSessionEvents() {
+ private void fireNewSessionEvents(final String sessionId) {
for (final IZkStateListener stateListener : _stateListener) {
- _eventThread.send(new ZkEvent("New session event sent to " +
stateListener) {
+ _eventThread.send(new ZkEvent("New session event sent to " +
stateListener, sessionId) {
@Override
public void run() throws Exception {
- stateListener.handleNewSession();
+ if (stateListener instanceof ZkSessionAwareStateListener) {
+ ((ZkSessionAwareStateListener)
stateListener).handleNewSession(sessionId);
+ } else {
+ stateListener.handleNewSession();
+ }
}
});
}
}
protected void fireStateChangedEvent(final KeeperState state) {
+ fireStateChangedEvent(state, null);
+ }
+
+ private void fireStateChangedEvent(final KeeperState state, final String
sessionId) {
for (final IZkStateListener stateListener : _stateListener) {
- _eventThread.send(new ZkEvent("State changed to " + state + " sent to "
+ stateListener) {
+ String description = "State changed to " + state + " sent to " +
stateListener;
+ _eventThread.send(new ZkEvent(description, sessionId) {
Review comment:
Nit: String.format?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]