+

Search Tips   |   Advanced Search

ActivitySession service APIs

The ActivitySession service provides an application programming interface that is available to Web applications, session Enterprise JavaBeans (EJBs), and Java platform for enterprise applications client applications for application-managed demarcation of ActivitySession context.

Applications use the UserActivitySession interface, which provides demarcation scope methods.


ActivitySession API

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 Java platform for enterprise applications 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. The UserActivitySession interface is used to begin and end ActivitySessions and to query various attributes of the active ActivitySession that is associated with the thread.

For more information about the ActivitySession API, see the API (API) reference information.

The ActivitySession API and the implementation of its interfaces is contained in the com.ibm.websphere.ActivitySession package.


Programming Examples

The following code extract provides a basic example of using the UserActivitySession interface:

// 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);


Related concepts

  • The ActivitySession service
  • ActivitySession samples

  • Additional APIs Concept topic