Class LockRegistryLeaderInitiator

java.lang.Object
org.springframework.integration.support.leader.LockRegistryLeaderInitiator
All Implemented Interfaces:
Aware, DisposableBean, ApplicationEventPublisherAware, Lifecycle, Phased, SmartLifecycle

public class LockRegistryLeaderInitiator
extends Object
implements SmartLifecycle, DisposableBean, ApplicationEventPublisherAware
Component that initiates leader election based on holding a lock. If the lock has the right properties (global with expiry), there will never be more than one leader, but there may occasionally be no leader for short periods. If the lock has stronger guarantees, and it interrupts the holder's thread when it expires or is stolen, then you can adjust the parameters to reduce the leaderless period to be limited only by latency to the lock provider. The election process ties up a thread perpetually while we hold and try to acquire the lock, so a native leader initiator (not based on a lock) is likely to be more efficient. If there is no native leader initiator available, but there is a lock registry (e.g. on a shared database), this implementation is likely to be useful.
Since:
4.3.1
Author:
Dave Syer, Artem Bilan, Vedran Pavic, Glenn Renfro, Kiel Boatman, Gary Russell