Ding Jinqiang created CURATOR-49:
------------------------------------

             Summary: LeaderSelector has no response when delete the leader 
node by other clients
                 Key: CURATOR-49
                 URL: https://issues.apache.org/jira/browse/CURATOR-49
             Project: Apache Curator
          Issue Type: Bug
          Components: Recipes
    Affects Versions: 2.1.0-incubating
         Environment: curator-recipes 2.1.0-incubating and  zookeeper 3.4.5
            Reporter: Ding Jinqiang


If I setup a normal LeaderSelection with two participants, and as expected one 
of them becomes the leader. But when I delete the leader node manually by other 
clients, the other leaderSelector becomes the leader normally. But the 
leaderSelector, which is the previous leader, does not receive any notification 
in the LeaderSelectorListener. 

Well, my question is, is this normal, or I just missed something? 

Sample code may like this:

                RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 1);
                client = 
CuratorFrameworkFactory.newClient(Config.getInstance().getServerConnectString(),
                                retryPolicy);
                client.start();
                LeaderSelectorListener listener = new LeaderSelectorListener() {

                        @Override
                        public void takeLeadership(CuratorFramework client) 
throws Exception {
                                logger.info("takeLeadership, thread 
id:"+Thread.currentThread().getId());
                                Thread.sleep(Long.MAX_VALUE);
                        }

                        @Override
                        public void stateChanged(CuratorFramework client, 
ConnectionState newState) {
                                logger.info("Zookeeper connection stateChanged, 
new state is " + newState);
                        }
                };
                selector = new LeaderSelector(client, 
Config.getInstance().getEclectPath());
                selector.autoRequeue();
                selector.start();


 



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to