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(); }
@Override public void electLeader(String ELECTION_PATH, LeaderSelectorListener listener) {}
public void electLeader(String ELECTION_PATH, LeaderSelectorListener listener) { leaderSelector = new LeaderSelector(client, ELECTION_PATH, listener); leaderSelector.autoRequeue(); leaderSelector.start(); }