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 UserCoordinator
WrongStateException
- 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 UserCoordinator
timeout
- 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
SystemException
public void close() throws InvalidActivityException, WrongStateException, ProtocolViolationException, NoCoordinatorException, CoordinatorCancelledException, NoPermissionException, SystemException
close
in interface UserCoordinator
InvalidActivityException
- 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.NoCoordinatorException
CoordinatorCancelledException
public void cancel() throws InvalidActivityException, WrongStateException, ProtocolViolationException, NoCoordinatorException, CoordinatorConfirmedException, NoPermissionException, SystemException
cancel
in interface UserCoordinator
InvalidActivityException
- 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.NoCoordinatorException
CoordinatorConfirmedException
Outcome
public void complete() throws InvalidActivityException, WrongStateException, ProtocolViolationException, NoCoordinatorException, NoPermissionException, SystemException
complete
in interface UserCoordinator
InvalidActivityException
- 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.NoCoordinatorException
Outcome
public void setCancelOnly() throws NoCoordinatorException, WrongStateException, SystemException
setCancelOnly
in interface UserCoordinator
WrongStateException
- Thrown if the completion status is
incompatible with the current state of the activity.SystemException
- Thrown if any other error occurs.NoCoordinatorException
public int getTimeout() throws SystemException
getTimeout
in interface UserCoordinator
SystemException
- Thrown if any error occurs.public void setTimeout(int timeout) throws InvalidTimeoutException, SystemException
setTimeout
in interface UserCoordinator
timeout
- 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 UserCoordinator
SystemException
- Thrown if any error occurs.Status
public ActivityHierarchy suspend() throws SystemException
suspend
in interface UserCoordinator
SystemException
- Thrown if any error occurs.public void resume(ActivityHierarchy tx) throws InvalidActivityException, SystemException
resume
in interface UserCoordinator
tx
- 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 CoordinatorManager
act
- 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.NoCoordinatorException
public void delistParticipant(String participantId) throws InvalidParticipantException, NoCoordinatorException, WrongStateException, SystemException
delistParticipant
in interface CoordinatorManager
participantId
- 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.NoCoordinatorException
public void participantCompleted(String participantId) throws NoActivityException, InvalidParticipantException, WrongStateException, SystemException
CoordinatorManager
participantCompleted
in interface CoordinatorManager
participantId
- 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
CoordinatorManager
participantFaulted
in interface CoordinatorManager
participantId
- 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
CoordinatorManager
participantCannotComplete
in interface CoordinatorManager
participantId
- 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.WrongStateException
public ActivityHierarchy currentActivity() throws SystemException
currentActivity
in interface UserCoordinator
SystemException
- Thrown if any error occurs.public CoordinatorId identifier() throws NoActivityException, SystemException
identifier
in interface UserCoordinator
NoActivityException
- 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.