[ https://issues.apache.org/jira/browse/S4-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420525#comment-13420525 ]
Daniel Gómez Ferro commented on S4-85: -------------------------------------- Patch is good and works as expected, +1 > Improve handling of ZK connection changes > ------------------------------------------ > > Key: S4-85 > URL: https://issues.apache.org/jira/browse/S4-85 > Project: Apache S4 > Issue Type: Improvement > Affects Versions: 0.5 > Reporter: Daniel Gómez Ferro > Assignee: Matthieu Morel > Fix For: 0.5 > > > Currently we are handling ZK state changes a bit differently in two places. > org.apache.s4.comm.topology.AssignmentFromZK: > {code} > @Override > public void handleStateChanged(KeeperState state) throws Exception { > this.state = state; > if (!state.equals(KeeperState.SyncConnected)) { > logger.warn("Session not connected for cluster [{}]: [{}]. Trying > to reconnect", clusterName, state.name()); > zkClient.close(); > zkClient.connect(connectionTimeout, null); > handleNewSession(); > } > } > {code} > org.apache.s4.comm.topology.ClusterFromZK: > {code} > @Override > public void handleStateChanged(KeeperState state) throws Exception { > this.state = state; > if (!state.equals(KeeperState.SyncConnected)) { > logger.warn("Session not connected for cluster [{}]: [{}]. Trying > to reconnect", clusterName, state.name()); > zkClient.connect(connectionTimeout, null); > handleNewSession(); > } > } > {code} > In the first case we explicitly close the connection before trying to > reconnect. Furthermore, I think we should only try to reconnect when the > state is equals to {{KeeperState.Expired}}, since now we are closing the > connection on a {{Disconnected}} event too. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira