Interface Participant
-
@ConsumerType public interface Participant
A Participant participates in a Coordination.A Participant can participate in a Coordination by
registering
itself with the Coordination. After successfully registering itself, the Participant is notified when the Coordination is terminated.If a Coordination terminates
normally
, then all registered Participants are notified on theirended(Coordination)
method. If the Coordination terminates as afailure
, then all registered Participants are notified on theirfailed(Coordination)
method.Participants are required to be thread safe as notification can be made on any thread.
A Participant can only be registered with a single active Coordination at a time. If a Participant is already registered with an active Coordination, attempts to register the Participation with another active Coordination will block until the Coordination the Participant is registered with terminates. Notice that in edge cases the notification to the Participant that the Coordination has terminated can happen before the registration method returns.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
ended(Coordination coordination)
Notification that a Coordination has terminatednormally
.void
failed(Coordination coordination)
Notification that a Coordination has terminated as afailure
.
-
-
-
Method Detail
-
ended
void ended(Coordination coordination) throws java.lang.Exception
Notification that a Coordination has terminatednormally
.This Participant should finalize any work associated with the specified Coordination.
- Parameters:
coordination
- The Coordination that has terminated normally.- Throws:
java.lang.Exception
- If this Participant throws an exception, theCoordinator
service should log the exception. TheCoordination.end()
method which is notifying this Participant must continue notification of other registered Participants. When this is completed, theCoordination.end()
method must throw a CoordinationException of typeCoordinationException.PARTIALLY_ENDED
.
-
failed
void failed(Coordination coordination) throws java.lang.Exception
Notification that a Coordination has terminated as afailure
.This Participant should discard any work associated with the specified Coordination.
- Parameters:
coordination
- The Coordination that has terminated as a failure.- Throws:
java.lang.Exception
- If this Participant throws an exception, theCoordinator
service should log the exception. TheCoordination.fail(Throwable)
method which is notifying this Participant must continue notification of other registered Participants.
-
-