com.ibm.ws.javax.activity
Interface ActivityManager
- All Superinterfaces:
- UserActivity
- public interface ActivityManager
- extends UserActivity
The ActivityManager interface extends the UserActivity interface by offering methods to manipulate the Activity context. This interface is not available to services built on top of the Activity service but is available to an EJB container.
Method Summary GlobalId hibernate()
Suspends the association of all Activities from the calling thread of execution and permits the passivation of Activity resources from active memory to passive storage.void reactivate(GlobalId globalId)
Retrieves the Activity hierarchy, represented by the globalId, into active storage and reassociates the context hierarchy with the calling thread of execution.void resume(ActivityToken activity)
Resumes the association of the Activity, and any nested contexts, represented by the ActivityToken with the calling thread of execution.void resumeAll(ActivityToken activity)
Resumes the association of all transaction and Activity contexts represented by the ActivityToken with the calling thread of execution.void resumeGroup(ActivityToken activity)
Resumes the association of the Activity, and any nested contexts, represented by the ActivityToken with the calling thread of execution.ActivityToken suspend()
Suspends the association of the current Activity from the calling thread of execution along with any child contexts nested within that Activity.ActivityToken suspendAll()
Suspends the association of all transaction and Activity contexts from the calling thread of execution.ActivityToken suspendGroup()
Suspends the association of the current Activity from the calling thread of execution along with any contexts belonging to the same ContextGroup.
Methods inherited from interface com.ibm.ws.javax.activity.UserActivity begin, broadcast, complete, completeWithStatus, forget, getCompletionStatus, getCoordinator, getGlobalId, getName, getParentCoordinator, getPropertyGroup, getService, getStatus, getTimeout, recover, recreate, registerService, setCompletionStatus, setTimeout
Method Detail suspend
public ActivityToken suspend() throws SystemException, ServiceNotRegisteredException
- Suspends the association of the current Activity from the calling thread of execution along with any child contexts nested within that Activity.
If the suspended Activity is nested within a parent then the parent context becomes associated with the thread on completion of this method.
- Returns:
- An ActivityToken representing the suspended Activity. This ActivityToken maintains knowledge of the nested contexts that were suspended when the target Activity was suspended as well as any parent context that was established as a result of the suspend operation.
The ActivityToken may be used on a subsequent call to resume but not to resumeAll or resumeGroup.
If the calling thread is not associated with any Activity then null is returned.- Throws:
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
resume
public void resume(ActivityToken activity) throws com.ibm.ws.javax.activity.InvalidActivityException, InvalidParentContextException, SystemException, ServiceNotRegisteredException
- Resumes the association of the Activity, and any nested contexts, represented by the ActivityToken with the calling thread of execution. The ActivityToken represents a hierarchy of one of more contexts and must have been obtained by a prior call to suspend. The Activity is resumed as a child of any context that was on the thread prior to the invocation. A context may only be resumed as a child of the context within which it was originally begun.
If the specified ActivityToken is null, then no new associated is made.
- Parameters:
- activity - the ActivityToken to resume. The ActivityToken represents a hierarchy of one of more contexts and must have been obtained by a prior call to suspend.
- Throws:
- InvalidActivityException - Thrown if the specified ActivityToken does not represent a valid Activity or context hierarchy. No new association is made.
- InvalidParentException - Thrown if the parent context is different from that in which the resumed Activity was begun. No new association is made.
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
- InvalidParentContextException
suspendGroup
public ActivityToken suspendGroup() throws SystemException, ServiceNotRegisteredException
- Suspends the association of the current Activity from the calling thread of execution along with any contexts belonging to the same ContextGroup. The ContextGroup is an attribute of the ServiceManager for the target ActivityManager instance. If no ServiceManager is registered with the ActivityManager instance, then the current Activity is a part of the default ContextGroup and all the contexts within this ContextGroup are suspended.
On completion of this method, no context that is part of the same ContextGroup as the suspended Activity remains associated with the thread.
- Returns:
- An ActivityToken representing the suspended ContextGroup hierarchy of contexts.
The ActivityToken may be used on a subsequent call to resumeGroup but not to resume or resumeAll.
If the calling thread is not associated with any Activity then null is returned.- Throws:
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
resumeGroup
public void resumeGroup(ActivityToken activity) throws com.ibm.ws.javax.activity.InvalidActivityException, InvalidParentContextException, SystemException, ServiceNotRegisteredException
- Resumes the association of the Activity, and any nested contexts, represented by the ActivityToken with the calling thread of execution. The ActivityToken represents a hierarchy of contexts in the same ContextGroup and must have been obtained by a prior call to suspendGroup. There must be no context belonging to this ContextGroup active on the thread at the initiation of this operation.
If the specified ActivityToken is null, then no new associated is made.
- Parameters:
- activity - the ActivityToken to resume. The ActivityToken represents a hierarchy of one of more contexts and must have been obtained by a prior call to suspendGroup.
- Throws:
- InvalidActivityException - Thrown if the specified ActivityToken does not represent a valid Activity or context hierarchy belonging to the same ContextGroup. No new association is made.
- InvalidParentException - Thrown if a context belonging to the same ContextGroup as the resuming contexts is already associated with the thread of execution. No new association is made.
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
- InvalidParentContextException
suspendAll
public ActivityToken suspendAll() throws SystemException, ServiceNotRegisteredException
- Suspends the association of all transaction and Activity contexts from the calling thread of execution. On completion of this method, no transaction or Activity context remain associated with the thread.
- Returns:
- An ActivityToken representing the suspended hierarchy of contexts.
The ActivityToken may be used on a subsequent call to resumeAll but not to resume or resumeGroup.
If the calling thread is not associated with any Activity then null is returned.- Throws:
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
resumeAll
public void resumeAll(ActivityToken activity) throws com.ibm.ws.javax.activity.InvalidActivityException, InvalidParentContextException, SystemException, ServiceNotRegisteredException
- Resumes the association of all transaction and Activity contexts represented by the ActivityToken with the calling thread of execution. The ActivityToken represents a hierarchy of contexts and must have been obtained by a prior call to suspendAll. There must be no transaction or Activity context active on the thread at the initiation of this operation.
If the specified ActivityToken is null, then no new associated is made.
- Parameters:
- activity - the ActivityToken to resume. The ActivityToken represents a hierarchy of one of more contexts and must have been obtained by a prior call to suspendAll.
- Throws:
- InvalidActivityException - Thrown if the specified ActivityToken does not represent a valid Activity or context hierarchy. No new association is made.
- InvalidParentException - Thrown if a transaction or Activity context is already associated with the thread of execution. No new association is made.
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
- InvalidParentContextException
hibernate
public GlobalId hibernate() throws ServiceNotRegisteredException, com.ibm.ws.javax.activity.InvalidActivityException, SystemException
- Suspends the association of all Activities from the calling thread of execution and permits the passivation of Activity resources from active memory to passive storage. On completion of this method, no Activity remains associated with the thread. The container hosting an HLS may call this method at any time prior to completion of an Activity and before or after an Activity is made persistent. The hibernation of an Activity does not impact whether or not the Activity is persistent, merely whether or not the Activity is required to be loaded into memory. An Activity must be reactivated by the container before it can be used again. An Activity hierarchy that contains a transaction cannot be hibernated.
- Returns:
- An GlobalId representing the root parent Activity in the hibernated Activity hierarchy.
- Throws:
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
- InvalidActivityException - Thrown if the Activity hierarchy contains a transaction.
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
reactivate
public void reactivate(GlobalId globalId) throws com.ibm.ws.javax.activity.ActivityCompletedException, InvalidParentContextException, ServiceNotRegisteredException, SystemException
- Retrieves the Activity hierarchy, represented by the globalId, into active storage and reassociates the context hierarchy with the calling thread of execution. There must be no transaction or Activity active on the thread at the initiation of this operation. The container hosting an HLS may call this method at any time after previously hibernating the Activity hierarchy. If the specified globalId is null, then no Activity is reactivated.
- Parameters:
- globalId - the GlobalId of the Activity whose hierachy is to be reactivated from hibernation.
- Throws:
- ActivityCompletedException - Thrown if the Activity service has no knowledge of the specified globalId - for example if the Activity it identifies has already completed or if there has been a failure following hibernation of a non-persistent Activity
- InvalidParentContextException - Thrown if a transaction or Activity is already associated with the thread of execution. No new association is made.
- ServiceNotRegisteredException - Thrown if no ServiceManager has been registered.
- SystemException - Thrown if the Activity service encounters an unexpected error condition.
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.