com.ibm.websphere.ActivitySession
Interface UserActivitySession


public interface UserActivitySession

This interface defines the set of ActivitySession operations available to an application component. An implementation of this interface is obtained via a JNDI lookup of the URL "java:comp/websphere/UserActivitySession. The UserActivitySession interface is used to begin and end ActivitySessions and to query various attributes of the active ActivitySession associated with the thread.


Field Summary
static int EndModeCheckPoint
          Attempt to CheckPoint all ActivitySessionResources
static int EndModeReset
          Attempt to Reset all ActivitySessionResources
static int StatusNoSession
          There is no active ActivitySession associated with the calling thread
static int StatusSessionActive
          There is an active ActivitySession associated with the calling thread
static int StatusSessionCompleted
          The ActivitySession associated with the calling thread has completed
static int StatusSessionCompleting
          The ActivitySession associated with the calling thread is in the process of ending
static int StatusUnknown
          The ActivitySession service is unable to determine the status of the ActivitySession associated with the calling thread.
 
Method Summary
 void beginSession()
          Create a new ActivitySession and associate it with the current thread.
 void checkpointSession()
          CheckPoints all the ActivitySessionResources involved in the current ActivitySession but allows further work within the ActivitySession.
 void endSession(int EndMode)
          Complete the ActivitySession associated with the current thread and CheckPoints or Resets all the ActivitySessionResources involved in it.
 java.lang.String getSessionName()
          Obtain the name of the ActivitySession associated with the thread.
 int getSessionTimeout()
          Returns the default timeout value.
 int getStatus()
          Obtain the status of the ActivitySession associated with the current thread.
 void resetSession()
          Resets all the ActivitySessionResources involved in the current ActivitySession but allows further work within the ActivitySession.
 void setResetOnly()
          Marks the ActivitySession associated with the current thread such that the only possible outcome is Reset.
 void setSessionTimeout(int timeout)
          Sets the default timeout, in seconds, after which any subsequently started ActivitySessions may be automatically completed by the ActivitySession service.
 

Field Detail

EndModeCheckPoint

public static final int EndModeCheckPoint
Attempt to CheckPoint all ActivitySessionResources

See Also:
Constant Field Values

EndModeReset

public static final int EndModeReset
Attempt to Reset all ActivitySessionResources

See Also:
Constant Field Values

StatusSessionActive

public static final int StatusSessionActive
There is an active ActivitySession associated with the calling thread

See Also:
Constant Field Values

StatusSessionCompleting

public static final int StatusSessionCompleting
The ActivitySession associated with the calling thread is in the process of ending

See Also:
Constant Field Values

StatusSessionCompleted

public static final int StatusSessionCompleted
The ActivitySession associated with the calling thread has completed

See Also:
Constant Field Values

StatusNoSession

public static final int StatusNoSession
There is no active ActivitySession associated with the calling thread

See Also:
Constant Field Values

StatusUnknown

public static final int StatusUnknown
The ActivitySession service is unable to determine the status of the ActivitySession associated with the calling thread. This is a transient condition.

See Also:
Constant Field Values
Method Detail

beginSession

public void beginSession()
                  throws ActivitySessionAlreadyActiveException,
                         TransactionPendingException,
                         NotSupportedException,
                         SystemException
Create a new ActivitySession and associate it with the current thread.

Throws:
ActivitySessionAlreadyActiveException - Thrown if the thread is already associated with a session.
TransactionPendingException - Thrown if the thread is associated with a transaction. ActivitySessions may not be nested within transactions.
NotSupportedException - Thrown if the access to the UserActivitySession interface is not allowed, for example if the caller is executing under an ActivitySession container policy of ActivitySessionNotSupported
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition

endSession

public void endSession(int EndMode)
                throws ActivitySessionPendingException,
                       ContextPendingException,
                       NoActivitySessionException,
                       NotOriginatorException,
                       MixedOutcomeException,
                       ActivitySessionResetException,
                       NotSupportedException,
                       SystemException
Complete the ActivitySession associated with the current thread and CheckPoints or Resets all the ActivitySessionResources involved in it. When this method completes, the thread becomes associated with no ActivitySession.
If there is a contained transaction within the ActivitySession context and the EndMode is EndModeCheckpoint, then the ContextPendingException is raised and neither the transaction context nor the ActivitySession context are affected by the operation. The caller must either complete the transaction first or end the ActivitySession with an EndModeReset.
If there are contained transactions within the ActivitySession context and the EndMode is EndModeReset, then the contained transactions are marked rollback_only.

Parameters:
EndMode - indicates the EndMode with which enlisted ActivitySessionResources should be directed to complete.
Throws:
ActivitySessionPendingException - Thrown to indicate that there is outstanding asynchronous work associated with the ActivitySession. The ActivitySession remains active.
ContextPendingException - Thrown if there is a contained transaction that has not been completed and the EndMode is EndModeCheckPoint. The ActivitySession and transaction contexts remain unchanged.
NoActivitySessionException - Thrown to indicate that no ActivitySession is associated with the current thread.
NotOriginatorException - Thrown to indicate that the calling thread does not belong in the originating execution environment and that this operation is therefore disallowed.
MixedOutcomeException - Thrown if the ActivitySessionResources enlisted in the ActivitySesison were not all completed in the same direction. An array of NotProcessedExceptions indicates the resources that were Reset.
ActivitySessionResetException - Thrown if a request to checkpoint resulted in all the ActivitySessionResources being reset.
NotSupportedException - Thrown if the access to the UserActivitySession interface is not allowed, for example if the caller is executing under an ActivitySession container policy of ActivitySessionNotSupported
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition

resetSession

public void resetSession()
                  throws ActivitySessionPendingException,
                         NoActivitySessionException,
                         NotOriginatorException,
                         NotSupportedException,
                         SystemException
Resets all the ActivitySessionResources involved in the current ActivitySession but allows further work within the ActivitySession. When this method completes, the thread is associated with the same ActivitySession as it was prior to this method being called. The ActivitySessionResources remain associated with the ActivitySession although they may not participate further in the ActivitySession.

Throws:
ActivitySessionPendingException - Thrown to indicate that there is outstanding asynchronous work associated with the ActivitySession. No ActivitySessionResources are Reset
NoActivitySessionException - Thrown to indicate that no ActivitySession is associated with the current thread.
NotOriginatorException - Thrown to indicate that the calling thread does not belong in the originating execution environment and that this operation is therefore disallowed.
NotSupportedException - Thrown if the access to the UserActivitySession interface is not allowed, for example if the caller is executing under an ActivitySession container policy of ActivitySessionNotSupported
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition

checkpointSession

public void checkpointSession()
                       throws ActivitySessionPendingException,
                              NoActivitySessionException,
                              NotOriginatorException,
                              MixedOutcomeException,
                              ActivitySessionResetException,
                              NotSupportedException,
                              SystemException
CheckPoints all the ActivitySessionResources involved in the current ActivitySession but allows further work within the ActivitySession. When this method completes, the thread is associated with the same ActivitySession as it was prior to this method being called. The ActivitySessionResources remain associated with the ActivitySession although they may not participate further in the ActivitySession.

Throws:
ActivitySessionPendingException - Thrown to indicate that there is outstanding asynchronous work associated with the ActivitySession. No ActivitySessionResources are CheckPointed.
NoActivitySessionException - Thrown to indicate that no ActivitySession is associated with the current thread.
NotOriginatorException - Thrown to indicate that the calling thread does not belong in the originating execution environment and that this operation is therefore disallowed.
MixedOutcomeException - Thrown if the ActivitySessionResources enlisted in the ActivitySesison were not all completed in the same direction. An array of NotProcessedExceptions indicates the resources that were Reset.
ActivitySessionResetException - Thrown if a request to checkpoint resulted in all the ActivitySessionResources being reset.
NotSupportedException - Thrown if the access to the UserActivitySession interface is not allowed, for example if the caller is executing under an ActivitySession container policy of ActivitySessionNotSupported
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition

getStatus

public int getStatus()
              throws SystemException
Obtain the status of the ActivitySession associated with the current thread.

Returns:
The ActivitySession status. If no ActivitySession is associated with the current thread, this method returns the Status StatusNoSession
Throws:
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition

getSessionName

public java.lang.String getSessionName()
                                throws SystemException
Obtain the name of the ActivitySession associated with the thread. Typically this is a human-readable form of a unique identity value - e.g. the string-form of a UUID - that distinctly identifies this ActivitySession.

Returns:
The ActivitySession name. If no ActivitySession is associated with the current thread, this method returns an empty string.
Throws:
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition

setSessionTimeout

public void setSessionTimeout(int timeout)
                       throws TimeoutOutOfRangeException,
                              SystemException
Sets the default timeout, in seconds, after which any subsequently started ActivitySessions may be automatically completed by the ActivitySession service.
The timeout is a useful mechanism for protecting against clients that fail to end an ActivitySession in a timely fashion.

Parameters:
timeout - the default time, in seconds, after which an ActivitySession may be automatically Reset by the ActivitySession service.
A value of -1 indicates no timeout.
A value of 0 indicates that a system-managed value or implementation-specific default should be used.
Throws:
TimeoutRangeException - Thrown if timeout is less than -1 or if it is greater than 1000000000 (1 billion).
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition.
TimeoutOutOfRangeException

getSessionTimeout

public int getSessionTimeout()
                      throws SystemException
Returns the default timeout value.

Returns:
The default timeout value, in seconds.
Throws:
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition.

setResetOnly

public void setResetOnly()
                  throws NoActivitySessionException,
                         SystemException
Marks the ActivitySession associated with the current thread such that the only possible outcome is Reset.

Throws:
NoActivitySessionException - Thrown to indicate that no ActivitySession is associated with the current thread.
SystemException - Thrown if the ActivitySession service encounters an unexpected error condition