- All Implemented Interfaces:
public class DefaultCandidate extends AbstractCandidate
Candidatefor leadership. This implementation simply logs when it is elected and when its leadership is revoked.
- Janne Valkealahti, Artem Bilan
Modifier and Type Method Description
onGranted(Context ctx)Callback method invoked when this candidate is elected leader.
onRevoked(Context ctx)Callback method invoked when this candidate is no longer leader.
yieldLeadership()Voluntarily yield leadership if held.
Methods inherited from class org.springframework.integration.leader.AbstractCandidate
public void onGranted(Context ctx)Description copied from interface:
CandidateCallback 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 throwing
InterruptedException. When the thread is interrupted, this indicates that this candidate is no longer leader.
public void onRevoked(Context ctx)Description copied from interface:
CandidateCallback 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.
public void yieldLeadership()Voluntarily yield leadership if held. If leader context is not yet known this method does nothing. Leader context becomes available only after
onGranted(Context)method is called by the leader initiator.
public String toString()