ActivitySession Service sample

The ActivitySession service is implemented as a high-level service in addition to the implementation of the Java 2 Platform, Enterprise Edition (J2EE) 1.4 Activity Service. It provides a unit-of-work scope within which unrecoverable or non-two-phase resources can be managed, and does this in a way that is both distributed and cooperative with respect to transactions. Use this collection of sample applications to explore the ActivitySession service.

Time required to set up and configure these samples

Less than one hour

Prerequisites for use

  • WebSphere® Application Server Version 8.0 or Version 8.5
Important: These samples were tested with WebSphere Application Server Version 8.0 and Version 8.5.

Samples download

To use the samples, download ActivitySession Service application sample files from a product download site. Complete the following steps:

  1. Choose one of the following methods to download the ActivitySessionSamples.zip file to a directory on your workstation: FTP or HTTP. You might create the /samples/ActivitySessionSamples directory path on your workstation and download ActivitySession sample files to that directory path.
  2. From the displayed dialog, specify the target directory to which to save the compressed file and click OK.
  3. The ActivitySessionSamples.zip file contains sample files in the following directory structure:
    /images
    /installableApps
    /META_INF
    /scripts
    /src
    /style
    build.xml
    readme.html
    Attention: The readme.html file contains information for installing and running the sample.

Samples description

HTTP session association (MasterMind Game)

A servlet provides the user interface for the MasterMind game. The game uses an HTTP session to control the ActivitySession life-cycle, and communicates with an enterprise bean, which holds the state and provides the logic for the game. The aim of the game is to guess the four-element code that is generated at the start. On each guess, clues are given to the identity of the target code by how many elements in the guess are present in the target and how many of these elements are correctly placed.

Container-managed ActivitySessions

This sample consists of a client, which begins and ends the ActivitySessions service, updating an entity bean. The sample demonstrates client access to the UserActivitySession interface, container-managed ActivitySessions service and container resolution of resource-managed local transactions. These transactions start within the enterprise beans that have a Local Transaction Containment (LTC) boundary of ActivitySession. The client verifies that updates to bean instances are committed when the ActivitySession service is completed with the EndModeCheckpoint and rolled back when the EndModeReset is used.

Bean-managed ActivitySessions

This sample consists of a client that invokes a method on a stateless session bean. This session bean uses bean-managed activity sessions, beginning and ending the ActivitySessions with the UserActivitySession interface. During these activity sessions, a stateful session bean is accessed. This stateful session bean, which uses the container-managed ActivitySession service, an LTC boundary of ActivitySession, and an LTC resolution control of Application, is called several times to update data in a database. Sometimes the stateful session bean is instructed to complete the resource manager local transactions (RMLTs), either to commit them or roll them back. Sometimes the RMLTs are incomplete. The stateless session bean then completes the ActivitySession service and reports back to the client whether the results are consistent with the expected behavior.

Concept topic    

Terms and conditions for product documentation | Feedback

Last updated: January 29, 2018 04:57 AM GMT-06:00
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=sample_activitysession
File name: sample_activitysession.html