Class LeaderInitiator
java.lang.Object
org.springframework.integration.zookeeper.leader.LeaderInitiator
- All Implemented Interfaces:
- Lifecycle,- Phased,- SmartLifecycle
Bootstrap leadership 
candidates
 with ZooKeeper/Curator. Upon construction, start() must be invoked to
 register the candidate for leadership election.- Since:
- 4.2
- Author:
- Patrick Peralta, Janne Valkealahti, Gary Russell, Artem Bilan, Ivan Zaitsev, Christian Tzolov
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassImplementation of leadership context backed by Curator.protected classImplementation of Curator leadership election listener.
- 
Field SummaryFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionLeaderInitiator(org.apache.curator.framework.CuratorFramework client, Candidate candidate) Construct aLeaderInitiator.LeaderInitiator(org.apache.curator.framework.CuratorFramework client, Candidate candidate, String namespace) Construct aLeaderInitiator.
- 
Method SummaryModifier and TypeMethodDescriptionThe context of the initiator.intgetPhase()booleanbooleanvoidsetAutoStartup(boolean autoStartup) voidsetLeaderEventPublisher(LeaderEventPublisher leaderEventPublisher) Sets theLeaderEventPublisher.voidsetPhase(int phase) voidstart()Start the registration of thecandidatefor leader election.voidstop()Stop the registration of thecandidatefor leader election.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecyclestop
- 
Constructor Details- 
LeaderInitiatorConstruct aLeaderInitiator.- Parameters:
- client- Curator client
- candidate- leadership election candidate
 
- 
LeaderInitiatorpublic LeaderInitiator(org.apache.curator.framework.CuratorFramework client, Candidate candidate, String namespace) Construct aLeaderInitiator.- Parameters:
- client- Curator client
- candidate- leadership election candidate
- namespace- namespace base path in zookeeper
 
 
- 
- 
Method Details- 
isRunningpublic boolean isRunning()
- 
getPhasepublic int getPhase()- Specified by:
- getPhasein interface- Phased
- Specified by:
- getPhasein interface- SmartLifecycle
 
- 
setPhasepublic void setPhase(int phase) - Parameters:
- phase- the phase
- See Also:
 
- 
isAutoStartuppublic boolean isAutoStartup()- Specified by:
- isAutoStartupin interface- SmartLifecycle
 
- 
setAutoStartuppublic void setAutoStartup(boolean autoStartup) - Parameters:
- autoStartup- true to start automatically
- See Also:
 
- 
startpublic void start()Start the registration of thecandidatefor leader election.
- 
stoppublic void stop()Stop the registration of thecandidatefor leader election. If the candidate is currently leader, its leadership will be revoked.
- 
setLeaderEventPublisherSets theLeaderEventPublisher.- Parameters:
- leaderEventPublisher- the event publisher
 
- 
getContextThe context of the initiator.- Returns:
- the context.
- Since:
- 5.0
 
 
-