Class LeaderInitiatorFactoryBean
java.lang.Object
org.springframework.integration.zookeeper.config.LeaderInitiatorFactoryBean
- All Implemented Interfaces:
Aware
,FactoryBean<LeaderInitiator>
,InitializingBean
,ApplicationEventPublisherAware
,Lifecycle
,Phased
,SmartLifecycle
public class LeaderInitiatorFactoryBean
extends Object
implements FactoryBean<LeaderInitiator>, SmartLifecycle, InitializingBean, ApplicationEventPublisherAware
Creates a
LeaderInitiator
.- Since:
- 4.2
- Author:
- Gary Russell, Artem Bilan, Christian Tzolov
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Class<?>
int
getPhase()
boolean
boolean
void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) void
setAutoStartup
(boolean autoStartup) setCandidate
(Candidate candidate) Configure aCandidate
for leader election.setClient
(org.apache.curator.framework.CuratorFramework client) void
setLeaderEventPublisher
(LeaderEventPublisher leaderEventPublisher) ALeaderEventPublisher
option for events from theLeaderInitiator
.void
setPhase
(int phase) Configure a role forDefaultCandidate
.void
start()
void
stop()
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Constructor Details
-
LeaderInitiatorFactoryBean
public LeaderInitiatorFactoryBean()
-
-
Method Details
-
setClient
-
setPath
-
setRole
Configure a role forDefaultCandidate
. Or this orsetCandidate(Candidate)
can be configured, but not both.- Parameters:
role
- the role for candidate- Returns:
- this instance
-
setCandidate
Configure aCandidate
for leader election. Or this orsetRole(String)
can be configured, but not both.- Parameters:
candidate
- theCandidate
to use- Returns:
- this instance
- Since:
- 5.3
-
setLeaderEventPublisher
ALeaderEventPublisher
option for events from theLeaderInitiator
.- Parameters:
leaderEventPublisher
- theLeaderEventPublisher
to use.- Since:
- 4.3.2
-
setPhase
public void setPhase(int phase) -
setAutoStartup
public void setAutoStartup(boolean autoStartup) -
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
start
public void start() -
stop
public void stop() -
stop
- Specified by:
stop
in interfaceSmartLifecycle
-
isRunning
public boolean isRunning() -
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-
getObject
- Specified by:
getObject
in interfaceFactoryBean<LeaderInitiator>
-
getObjectType
- Specified by:
getObjectType
in interfaceFactoryBean<LeaderInitiator>
-