public class CoordinatorServiceImple extends Object implements UserCoordinator, CoordinatorManager
Constructor and Description |
---|
CoordinatorServiceImple() |
Modifier and Type | Method and Description |
---|---|
void |
begin(String serviceType)
Start a new activity.
|
void |
begin(String serviceType,
int timeout)
Start a new activity.
|
void |
cancel()
Cancel the activity.
|
void |
confirm()
Confirm the activity.
|
CoordinatorControl |
coordinatorControl() |
ActivityImple |
current() |
ActivityHierarchy |
currentActivity() |
void |
delistParticipant(Participant act)
Remove the specified participant from the coordinator's list.
|
void |
delistSynchronization(Synchronization act)
Remove the specified synchronization from the coordinator's list.
|
void |
enlistParticipant(Participant act)
Enrol the specified participant with the coordinator associated with the
current thread.
|
void |
enlistSynchronization(Synchronization act)
Enrol the specified synchronization with the coordinator associated with
the current thread.
|
int |
getTimeout()
Get the timeout value currently associated with activities.
|
CoordinatorId |
identifier() |
void |
participantReadOnly(String participantId)
A participant is readonly.
|
void |
participantRolledback(String participantId)
The participant has rolled back.
|
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 serviceType) 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 serviceType, int timeout) throws WrongStateException, InvalidTimeoutException, SystemException
begin
in interface UserCoordinator
timeout
- 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 void confirm() throws InvalidActivityException, WrongStateException, ProtocolViolationException, NoCoordinatorException, CoordinatorCancelledException, HeuristicMixedException, HeuristicHazardException, NoPermissionException, SystemException
confirm
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
HeuristicMixedException
HeuristicHazardException
public void cancel() throws InvalidActivityException, WrongStateException, ProtocolViolationException, NoCoordinatorException, CoordinatorConfirmedException, HeuristicMixedException, HeuristicHazardException, 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
HeuristicMixedException
HeuristicHazardException
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
- 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
ActivityHierarchy
- 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
Participant
- 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(Participant act) throws InvalidParticipantException, NoCoordinatorException, WrongStateException, SystemException
delistParticipant
in interface CoordinatorManager
act
- 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 enlistSynchronization(Synchronization act) throws WrongStateException, DuplicateSynchronizationException, InvalidSynchronizationException, NoCoordinatorException, SystemException
enlistSynchronization
in interface CoordinatorManager
Synchronization
- act The synchronization to remove.WrongStateException
- Thrown if the coordinator is not in a state that allows
participants to be enrolled.DuplicateSynchronizationException
- Thrown if the participant has already been enrolled and
the coordination protocol does not support multiple
entries.InvalidSynchronizationException
- Thrown if the participant is invalid.SystemException
- Thrown if any other error occurs.NoCoordinatorException
public void delistSynchronization(Synchronization act) throws InvalidSynchronizationException, NoCoordinatorException, WrongStateException, SystemException
delistSynchronization
in interface CoordinatorManager
act
- The synchronization to remove.InvalidSynchronizationException
- 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 participantRolledback(String participantId) throws NoActivityException, InvalidParticipantException, WrongStateException, SystemException
participantRolledback
in interface CoordinatorManager
Participant
- act The participant.NoActivityException
- Thrown if there is no activity associated with the current
thread.WrongStateException
- Thrown if the coordinator is not in a state that allows
participants to be removed.InvalidParticipantException
- Thrown if the participant is invalid.SystemException
- Thrown if any other error occurs.public void participantReadOnly(String participantId) throws NoActivityException, InvalidParticipantException, SystemException
participantReadOnly
in interface CoordinatorManager
Participant
- act 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 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()
public final CoordinatorControl coordinatorControl()
Copyright © 2017 JBoss by Red Hat. All rights reserved.