incubator-s4-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gómez Ferro (JIRA) <j...@apache.org>
Subject [jira] [Created] (S4-85) Improve handling of ZK connection changes
Date Tue, 17 Jul 2012 07:45:33 GMT
Daniel Gómez Ferro created S4-85:
------------------------------------

             Summary: Improve handling of ZK connection changes 
                 Key: S4-85
                 URL: https://issues.apache.org/jira/browse/S4-85
             Project: Apache S4
          Issue Type: Improvement
            Reporter: Daniel Gómez Ferro


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

       

Mime
View raw message