Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop ActivitySessions > Develop an enterprise application to use ActivitySessions


ActivitySession service application programming interfaces

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 reference information.

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


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

The ActivitySession service
ActivitySession samples
Use the ActivitySession service


Related


Additional Application Programming Interfaces (APIs)

+

Search Tips   |   Advanced Search