Java 类org.apache.curator.framework.recipes.leader.LeaderSelectorListener 实例源码

项目:workflow    文件:SchedulerSelector.java   
public SchedulerSelector(WorkflowManagerImpl workflowManager, QueueFactory queueFactory, AutoCleanerHolder autoCleanerHolder)
{
    this.workflowManager = workflowManager;
    this.queueFactory = queueFactory;
    this.autoCleanerHolder = autoCleanerHolder;

    LeaderSelectorListener listener = new LeaderSelectorListenerAdapter()
    {
        @Override
        public void takeLeadership(CuratorFramework client) throws Exception
        {
            SchedulerSelector.this.takeLeadership();
        }
    };
    leaderSelector = new LeaderSelector(workflowManager.getCurator(), ZooKeeperConstants.getSchedulerLeaderPath(), listener);
    leaderSelector.autoRequeue();
}
项目:xio    文件:NullZkClient.java   
@Override
public void electLeader(String ELECTION_PATH, LeaderSelectorListener listener) {}
项目:xio    文件:ZkClient.java   
public void electLeader(String ELECTION_PATH, LeaderSelectorListener listener) {
  leaderSelector = new LeaderSelector(client, ELECTION_PATH, listener);

  leaderSelector.autoRequeue();
  leaderSelector.start();
}