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
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LeaderInitiatorFactoryBean()
-
Method Summary
Modifier and Type Method Description void
afterPropertiesSet()
LeaderInitiator
getObject()
Class<?>
getObjectType()
int
getPhase()
boolean
isAutoStartup()
boolean
isRunning()
void
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
void
setAutoStartup(boolean autoStartup)
LeaderInitiatorFactoryBean
setCandidate(Candidate candidate)
Configure aCandidate
for leader election.LeaderInitiatorFactoryBean
setClient(org.apache.curator.framework.CuratorFramework client)
void
setLeaderEventPublisher(LeaderEventPublisher leaderEventPublisher)
ALeaderEventPublisher
option for events from theLeaderInitiator
.LeaderInitiatorFactoryBean
setPath(String path)
void
setPhase(int phase)
LeaderInitiatorFactoryBean
setRole(String role)
Configure a role forDefaultCandidate
.void
start()
void
stop()
void
stop(Runnable callback)
-
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>
-