Class AbstractCandidate
java.lang.Object
org.springframework.integration.leader.AbstractCandidate
- All Implemented Interfaces:
Candidate
- Direct Known Subclasses:
DefaultCandidate
Base implementation of a
Candidate
.- Author:
- Janne Valkealahti, Gary Russell
-
Constructor Summary
ConstructorDescriptionInstantiate a abstract candidate.AbstractCandidate
(String id, String role) Instantiate a abstract candidate. -
Method Summary
-
Constructor Details
-
AbstractCandidate
public AbstractCandidate()Instantiate a abstract candidate. -
AbstractCandidate
Instantiate a abstract candidate.- Parameters:
id
- the identifierrole
- the role
-
-
Method Details
-
getRole
Description copied from interface:Candidate
Gets the role. -
getId
Description copied from interface:Candidate
Gets the identifier. -
onGranted
Description copied from interface:Candidate
Callback method invoked when this candidate is elected leader. Implementations may chose to launch a background thread to perform leadership roles and return immediately. Another option is for implementations to perform all leadership work in the thread invoking this method. In the latter case, the method must respond to thread interrupts by throwingInterruptedException
. When the thread is interrupted, this indicates that this candidate is no longer leader.- Specified by:
onGranted
in interfaceCandidate
- Parameters:
ctx
- leadership context- Throws:
InterruptedException
- when this candidate is no longer leader
-
onRevoked
Description copied from interface:Candidate
Callback method invoked when this candidate is no longer leader. Implementations should use this to shut down any resources (threads, network connections, etc) used to perform leadership work.
-