Class LeaderInitiator
java.lang.Object
org.springframework.integration.hazelcast.leader.LeaderInitiator
- All Implemented Interfaces:
Aware,DisposableBean,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle
@Deprecated(forRemoval=true,
since="6.5")
public class LeaderInitiator
extends Object
implements SmartLifecycle, DisposableBean, ApplicationEventPublisherAware
Deprecated, for removal: This API element is subject to removal in a future version.
with no replacement since this class relies on the CP Subsystem
which is not Open Source anymore since Hazelcast 5.5.
Bootstrap leadership
candidates
with Hazelcast. Upon construction, start() must be invoked to
register the candidate for leadership election.- Author:
- Patrick Peralta, Gary Russell, Dave Syer, Artem Bilan, Mael Le Guével, Alexey Tsoy, Robert Höglund, Christian Tzolov, Emil Palm
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classDeprecated, for removal: This API element is subject to removal in a future version.Implementation of leadership context backed by Hazelcast.protected classDeprecated, for removal: This API element is subject to removal in a future version.Callable that manages the acquisition of Hazelcast locks for leadership election. -
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionLeaderInitiator(com.hazelcast.core.HazelcastInstance client) Deprecated, for removal: This API element is subject to removal in a future version.Construct aLeaderInitiatorwith a default candidate.LeaderInitiator(com.hazelcast.core.HazelcastInstance client, Candidate candidate) Deprecated, for removal: This API element is subject to removal in a future version.Construct aLeaderInitiator. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.The context of the initiator or null if not running.intgetPhase()Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.trueif leadership election for thiscandidateis running.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) Deprecated, for removal: This API element is subject to removal in a future version.voidsetAutoStartup(boolean autoStartup) Deprecated, for removal: This API element is subject to removal in a future version.voidsetBusyWaitMillis(long busyWaitMillis) Deprecated, for removal: This API element is subject to removal in a future version.Time in milliseconds to wait in between attempts to acquire the lock, if it is not held.voidsetHeartBeatMillis(long heartBeatMillis) Deprecated, for removal: This API element is subject to removal in a future version.Time in milliseconds to wait in between attempts to re-acquire the lock, once it is held.voidsetLeaderEventPublisher(LeaderEventPublisher leaderEventPublisher) Deprecated, for removal: This API element is subject to removal in a future version.Set theLeaderEventPublisher.voidsetPhase(int phase) Deprecated, for removal: This API element is subject to removal in a future version.voidsetTaskExecutor(AsyncTaskExecutor taskExecutor) Deprecated, for removal: This API element is subject to removal in a future version.Set aAsyncTaskExecutorfor running leadership daemon.voidstart()Deprecated, for removal: This API element is subject to removal in a future version.Start the registration of thecandidatefor leader election.voidstop()Deprecated, for removal: This API element is subject to removal in a future version.Stop the registration of thecandidatefor leader election.voidDeprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
LeaderInitiator
public LeaderInitiator(com.hazelcast.core.HazelcastInstance client) Deprecated, for removal: This API element is subject to removal in a future version.Construct aLeaderInitiatorwith a default candidate.- Parameters:
client- Hazelcast client
-
LeaderInitiator
Deprecated, for removal: This API element is subject to removal in a future version.Construct aLeaderInitiator.- Parameters:
client- Hazelcast clientcandidate- leadership election candidate
-
-
Method Details
-
setTaskExecutor
Deprecated, for removal: This API element is subject to removal in a future version.Set aAsyncTaskExecutorfor running leadership daemon.- Parameters:
taskExecutor- theAsyncTaskExecutorto use.- Since:
- 6.2
-
setLeaderEventPublisher
Deprecated, for removal: This API element is subject to removal in a future version.Set theLeaderEventPublisher.- Parameters:
leaderEventPublisher- the event publisher
-
setHeartBeatMillis
public void setHeartBeatMillis(long heartBeatMillis) Deprecated, for removal: This API element is subject to removal in a future version.Time in milliseconds to wait in between attempts to re-acquire the lock, once it is held. The heartbeat time has to be less than the remote lock expiry period, if there is one, otherwise other nodes can steal the lock while we are sleeping here.- Parameters:
heartBeatMillis- the heart-beat timeout in milliseconds. Defaults toLockRegistryLeaderInitiator.DEFAULT_HEART_BEAT_TIME- Since:
- 1.0.1
-
setBusyWaitMillis
public void setBusyWaitMillis(long busyWaitMillis) Deprecated, for removal: This API element is subject to removal in a future version.Time in milliseconds to wait in between attempts to acquire the lock, if it is not held. The longer this is, the longer the system can be leaderless, if the leader dies. If a leader dies without releasing its lock, the system might still have to wait for the old lock to expire, but after that it should not have to wait longer than the busy wait time to get a new leader.- Parameters:
busyWaitMillis- the busy-wait timeout in milliseconds Defaults toLockRegistryLeaderInitiator.DEFAULT_BUSY_WAIT_TIME- Since:
- 1.0.1
-
setApplicationEventPublisher
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) Deprecated, for removal: This API element is subject to removal in a future version. -
isAutoStartup
public boolean isAutoStartup()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
isAutoStartupin interfaceSmartLifecycle
-
setPhase
public void setPhase(int phase) Deprecated, for removal: This API element is subject to removal in a future version. -
getPhase
public int getPhase()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getPhasein interfacePhased- Specified by:
getPhasein interfaceSmartLifecycle
-
getContext
Deprecated, for removal: This API element is subject to removal in a future version.The context of the initiator or null if not running.- Returns:
- the context (or null if not running)
-
start
public void start()Deprecated, for removal: This API element is subject to removal in a future version.Start the registration of thecandidatefor leader election. -
stop
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
stopin interfaceSmartLifecycle
-
stop
public void stop()Deprecated, for removal: This API element is subject to removal in a future version.Stop the registration of thecandidatefor leader election. If the candidate is currently leader, its leadership will be revoked. -
isRunning
public boolean isRunning()Deprecated, for removal: This API element is subject to removal in a future version.trueif leadership election for thiscandidateis running. -
destroy
public void destroy()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
destroyin interfaceDisposableBean
-