このコンテンツは選択した言語では利用できません。
21.2.4. BusinessActivityManager
com.arjuna.mw.wst11.BusinessActivityManager is the class that web services typically employ. Defines how a web service interacts with the underlying business activity service implementation. A
BusinessActivityManager does not represent a specific activity. Instead, it provides access to an implicit per-thread activity.
Methods
currentTransaction- Returns the
TxContextfor the current business activity, orNULLif there is noTxContext. The returned value can be used to enable multiple threads to execute within the scope of the same business activity. Calling thecurrenTransactionmethod does not dissociate the current thread from its activity. suspend- Dissociates a thread from any current business activity, so that it can perform work not associated with a specific activity. The
suspendmethod returns aTxContextinstance, which is a handle on the activity. The thread is then no longer associated with any activity. resume- Associates or re-associates a thread with a business activity, using its
TxContext. Before associating or re-associating the thread, it is disassociated from any business activity with which it is currently associated. If theTxContextisNULL, the thread is disassociated with all business activities, as though thesuspendmethod were called.Parameters
- txContext
- A TxContext instance as returned by
suspend, identifying the transaction to be resumed.
Exceptions
UnknownTransactionException- The business activity to which the
TxContextrefers is invalid in the scope of the invoking thread.
enlistForBusinessAgreementWithParticipantCompletion- Enroll the specified participant with current business activity, causing it to participate in the
BusinessAgreementWithParticipantCompletionprotocol. A unique identifier for the participant is also required.The return value is an instance of BAParticipantManager which can be used to notify the coordinator of changes in the participant state. In particular, since the participant is enlisted for the Participant Completion protcol it is expected to call the completed method of this returned instance when it has completed all the work it expects to do in this activity and has made all its changes permanent. Alternatively, if the participant does not need to perform any compensation actions should some other participant fail it can leave the activity by calling the exit method of the returned BAParticipantManager instance.Parameters
- participant
- An implementation of interface
BusinessAgreementWithParticipantCompletionParticipantwhoseclose,cancel, andcompensatemethods are called when the corresponding coordinator message is received. - id
- A unique identifier for the participant. The value of this String should differ for each enlisted participant. It should also be possible for a given identifier to determine that the participant belongs to the enlisting web service rather than some other web service deployed to the same container.
Exceptions
- UnknownTransactionException
- No transaction is associated with the invoking thread.
- WrongStateException
- The transaction is not in a state where new participants may be enrolled, as when it is terminating.
enlistForBusinessAgreementWithCoordinatorCompletion- Enroll the specified participant with current activity, causing it to participate in the
BusinessAgreementWithCoordinatorCompletionprotocol. A unique identifier for the participant is also required.The return value is an instance ofBAParticipantManagerwhich can be used to notify the coordinator of changes in the participant state. Note that in this case it is an error to call thecompletedmethod of this returned instance. With the Coordinator Completion protocol the participant is expected to wait until itscompletedmethod is called before it makes all its changes permanent. Alternatively, if the participant determiens that it has no changes to make, it can leave the activity by calling theexitmethod of the returnedBAParticipantManagerinstance.Parameters
- participant
- An implementation of interface BusinessAgreementWithCoordinatorCompletionParticipant whose completed, close, cancel and compensate methods are called when the corresponding coordinator message is received.
- id
- A unique identifier for the participant. The value of this String should differ for each enlisted participant. It should also be possible for a given identifier to determine that the participant belongs to the enlisting web service rather than some other web service deployed to the same container.
Exceptions
- >UnknownTransactionException
- No transaction is associated with the invoking thread.
- WrongStateException
- The transaction is not in a state where new participants may be enrolled, as when it is terminating.