Terminate this Coordination normally.
If this Coordination has been
#push() on the thread local
Coordination stack of another thread, this method does nothing except
throw a CoordinationException of type
CoordinationException#WRONG_THREAD.
If this Coordination has been
#push() on the thread local
Coordination stack of this thread but is not the
Coordinator#peek(), then the Coordinations
on the thread local Coordination stack above this Coordination must be
terminated and removed from the thread local Coordination stack before
this Coordination is terminated. Each of these Coordinations, starting
with the current Coordination, will be
#end(). If the termination throws a
CoordinationException, then the
next Coordination on the thread local Coordination stack will be
#fail(Throwable) with a failure cause of
the thrown CoordinationException. At the end of this process, this
Coordination will be the current Coordination and will have been
terminated as a failure if any of the terminated Coordinations threw a
CoordinationException
If this Coordination is the
Coordinator#peek(), then it will be
Coordinator#pop() from the
thread local Coordination stack.
If this Coordination is already terminated, a CoordinationException is
thrown. If this Coordination was terminated as a failure, the
#getFailure() will be the cause of the thrown
CoordinationException.
Otherwise, this Coordination is terminated normally and then all
registered
#getParticipants() are
Participant#ended(Coordination). Participants should
finalize any work associated with this Coordination. The successful
return of this method indicates that the Coordination has terminated
normally and all registered Participants have been notified of the normal
termination.
It is possible that one of the Participants throws an exception during
notification. If this happens, this Coordination is considered to have
partially failed and this method must throw a CoordinationException of
type
CoordinationException#PARTIALLY_ENDED after all the
registered Participants have been notified.