The ActivitySession service provides an application programming interface that is available to Web applications, session EJBs, and J2EE client applications for application-managed demarcation of ActivitySession context.
Applications use the UserActivitySession interface, which provides demarcation scope methods.
The ActivitySession service provides the UserActivitySession interface for use by EJB Session beans using bean-managed context demarcation, Web application components that are configured with the ActivitySession control attribute set to Web Application, and J2EE client applications. This UserActivitySession interface defines the set of ActivitySession operations that are available to an application component. To obtain an implementation of this interface, use a Java Naming and Directory Interface (JNDI) lookup of the URL java:comp/websphere/UserActivitySession. It is used to begin and end ActivitySessions and to query various attributes of the active ActivitySession that are associated with the thread.
For more information about the ActivitySession API, see Additional Application Programming Interfaces.
The ActivitySession API and the implementation of its interfaces is contained in the com.ibm.websphere.ActivitySession package.
// Get initial context InitialContext ic = new InitialContext(); // Lookup UserActivitySession UserActivitySession uas = (UserActivitySession)ic.lookup("java:comp/websphere/UserActivitySession"); // Set the ActivitySession timeout to 60 seconds uas.setSessionTimeout(60); // Start a new ActivitySession context uas.beginSession(); // Do some work under this context MyBeanA beanA.doSomething(); ... MyBeanB beanB.doSomethingElse(); // End the context uas.endSession(EndModeCheckpoint);