public class CoordinatorServiceImple extends Object implements UserCoordinator, CoordinatorManager
| Constructor and Description |
|---|
CoordinatorServiceImple() |
| Modifier and Type | Method and Description |
|---|---|
void |
begin(String coordinationType)
Start a new activity.
|
void |
begin(String coordinationType,
int timeout)
Start a new activity.
|
void |
cancel()
Cancel the activity.
|
void |
close()
Confirm the activity.
|
void |
complete()
Complete the activity.
|
BACoordinator |
createSubordinate()
Create a subordinate coordinator via the coordination control.
|
ActivityImple |
current() |
ActivityHierarchy |
currentActivity() |
void |
delistParticipant(String participantId)
Remove the specified participant from the coordinator's list.
|
void |
enlistParticipant(Participant act)
Enrol the specified participant with the coordinator associated with
the current thread.
|
int |
getTimeout()
Get the timeout value currently associated with activities.
|
CoordinatorId |
identifier() |
void |
participantCannotComplete(String participantId)
A participant cannot complete during normal execution or compensation.
|
void |
participantCompleted(String participantId)
The participant has completed its work and it ready to compensate
if necessary.
|
void |
participantFaulted(String participantId)
A participant has faulted during normal execution or compensation.
|
void |
resume(ActivityHierarchy tx)
Given a token representing a context, associate it with the current
thread of control.
|
void |
setCancelOnly()
Set the termination status for the current activity to cancel only.
|
void |
setTimeout(int timeout)
Set the timeout to be associated with all subsequently created
activities.
|
Status |
status() |
ActivityHierarchy |
suspend()
Suspend the current activity from this thread and return the token
representing the context, if any, or null otherwise.
|
public void begin(String coordinationType) throws WrongStateException, SystemException
begin in interface UserCoordinatorWrongStateException - Thrown if the any currently associated
activity is in a state that does not allow a new activity to be
enlisted.SystemException - Thrown in any other situation.public void begin(String coordinationType, int timeout) throws WrongStateException, InvalidTimeoutException, SystemException
begin in interface UserCoordinatortimeout - The timeout associated with the activity. If the
activity has not been terminated by the time this period elapses, then
it will automatically be terminated.WrongStateException - Thrown if the currently associated
activity is in a state that does not allow a new activity to be
enlisted as a child.InvalidTimeoutException - Thrown if the specified timeout is
invalid within the current working environment.SystemException - Thrown in any other situation.public BACoordinator createSubordinate() throws SystemException
SystemExceptionpublic void close()
throws InvalidActivityException,
WrongStateException,
ProtocolViolationException,
NoCoordinatorException,
CoordinatorCancelledException,
NoPermissionException,
SystemException
close in interface UserCoordinatorInvalidActivityException - Thrown if the current activity is a
parent activity with active children.WrongStateException - Thrown if the current activity is not in a
state that allows it to be completed in the status requested.ProtocolViolationException - Thrown if the a violation of the
activity service or HLS protocol occurs.NoPermissionException - Thrown if the invoking thread does
not have permission to terminate the transaction.SystemException - Thrown if some other error occurred.NoCoordinatorExceptionCoordinatorCancelledExceptionpublic void cancel()
throws InvalidActivityException,
WrongStateException,
ProtocolViolationException,
NoCoordinatorException,
CoordinatorConfirmedException,
NoPermissionException,
SystemException
cancel in interface UserCoordinatorInvalidActivityException - Thrown if the current activity is a
parent activity with active children.WrongStateException - Thrown if the current activity is not in a
state that allows it to be completed, or is incompatible with the
completion status provided.ProtocolViolationException - Thrown if the a violation of the
activity service or HLS protocol occurs.NoPermissionException - Thrown if the invoking thread does
not have permission to terminate the transaction.SystemException - Thrown if some other error occurred.NoCoordinatorExceptionCoordinatorConfirmedExceptionOutcomepublic void complete()
throws InvalidActivityException,
WrongStateException,
ProtocolViolationException,
NoCoordinatorException,
NoPermissionException,
SystemException
complete in interface UserCoordinatorInvalidActivityException - Thrown if the current activity is a
parent activity with active children.WrongStateException - Thrown if the current activity is not in a
state that allows it to be completed, or is incompatible with the
completion status provided.ProtocolViolationException - Thrown if the a violation of the
activity service or HLS protocol occurs.NoPermissionException - Thrown if the invoking thread does
not have permission to terminate the transaction.SystemException - Thrown if some other error occurred.NoCoordinatorExceptionOutcomepublic void setCancelOnly()
throws NoCoordinatorException,
WrongStateException,
SystemException
setCancelOnly in interface UserCoordinatorWrongStateException - Thrown if the completion status is
incompatible with the current state of the activity.SystemException - Thrown if any other error occurs.NoCoordinatorExceptionpublic int getTimeout()
throws SystemException
getTimeout in interface UserCoordinatorSystemException - Thrown if any error occurs.public void setTimeout(int timeout)
throws InvalidTimeoutException,
SystemException
setTimeout in interface UserCoordinatortimeout - The timeout (in seconds) to associate with all
subsequently created activities. This value must be 0 or greater.InvalidTimeoutException - Thrown if the timeout value provided
is negative, too large, or if timeouts are simply not supported by
the activity implementation.SystemException - Thrown if any other error occurs.public Status status() throws SystemException
status in interface UserCoordinatorSystemException - Thrown if any error occurs.Statuspublic ActivityHierarchy suspend() throws SystemException
suspend in interface UserCoordinatorSystemException - Thrown if any error occurs.public void resume(ActivityHierarchy tx) throws InvalidActivityException, SystemException
resume in interface UserCoordinatortx - The activity to associate with this thread. This
may be null in which case the current thread becomes associated with
no activity.InvalidActivityException - Thrown if the activity handle
is invalid in this context.SystemException - Thrown if any other error occurs.public void enlistParticipant(Participant act) throws WrongStateException, DuplicateParticipantException, InvalidParticipantException, NoCoordinatorException, SystemException
enlistParticipant in interface CoordinatorManageract - The participant.WrongStateException - Thrown if the coordinator is not in a
state that allows participants to be enrolled.DuplicateParticipantException - Thrown if the participant has
already been enrolled and the coordination protocol does not support
multiple entries.InvalidParticipantException - Thrown if the participant is invalid.SystemException - Thrown if any other error occurs.NoCoordinatorExceptionpublic void delistParticipant(String participantId) throws InvalidParticipantException, NoCoordinatorException, WrongStateException, SystemException
delistParticipant in interface CoordinatorManagerparticipantId - The participant to remove.InvalidParticipantException - Thrown if the participant is not known
of by the coordinator.WrongStateException - Thrown if the state of the coordinator
does not allow the participant to be removed (e.g., in a two-phase
protocol the coordinator is committing.)SystemException - Thrown if any other error occurs.NoCoordinatorExceptionpublic void participantCompleted(String participantId) throws NoActivityException, InvalidParticipantException, WrongStateException, SystemException
CoordinatorManagerparticipantCompleted in interface CoordinatorManagerparticipantId - The participant.NoActivityException - Thrown if there is no activity associated
with the current thread.InvalidParticipantException - Thrown if the participant is invalid.WrongStateException - Thrown if the coordinator is not in a
state that allows participants to be removed.SystemException - Thrown if any other error occurs.public void participantFaulted(String participantId) throws NoActivityException, InvalidParticipantException, SystemException
CoordinatorManagerparticipantFaulted in interface CoordinatorManagerparticipantId - The participant.NoActivityException - Thrown if there is no activity associated
with the current thread.InvalidParticipantException - Thrown if the participant is invalid.SystemException - Thrown if any other error occurs.public void participantCannotComplete(String participantId) throws NoActivityException, InvalidParticipantException, WrongStateException, SystemException
CoordinatorManagerparticipantCannotComplete in interface CoordinatorManagerparticipantId - The participant.NoActivityException - Thrown if there is no activity associated
with the current thread.InvalidParticipantException - Thrown if the participant is invalid.SystemException - Thrown if any other error occurs.WrongStateExceptionpublic ActivityHierarchy currentActivity() throws SystemException
currentActivity in interface UserCoordinatorSystemException - Thrown if any error occurs.public CoordinatorId identifier() throws NoActivityException, SystemException
identifier in interface UserCoordinatorNoActivityException - Thrown if there is no activity
associated with the invoking thread.SystemException - Thrown if some other error occurred.public final ActivityImple current()
Copyright © 2018 JBoss by Red Hat. All rights reserved.