WebSphere Extended Deployment, Version 6.0.x
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS


The compute-intensive programming model

Compute-intensive applications are applications that perform computationally intensive work that does not fit comfortably into the traditional Java 2 Platform Enterprise Edition (J2EE) request and response paradigm.

There are a number of characteristics that can make these applications unsuitable for traditional J2EE programming models:
The compute-intensive programming model provided by WebSphere Extended Deployment provides an environment that addresses these needs. The compute-intensive programming model is centered around two basic concepts:
  1. The use of jobs to submit and manage work asynchronously
  2. A minor extension to the asynchronous beans programming model to support work that runs for an extended period of time

The following sections provide additional information on the extensions to the asynchronous beans programming model.

Compute-intensive job steps

Like all long-running jobs, compute-intensive jobs are split into multiple job steps. In the case of compute-intensive jobs, each job step is represented by an instance of a class that implements the com.ibm.websphere.ci.CIWork interface. The CIWork interface extends the commonj.Work work interface from the application server asynchronous beans programming model and Java Specification Request (JSR) 237. These extensions consist of two methods that provide a way to pass the job-step-specific properties specified in the job to the CIWork object.

Refer to the API documentation for more details.

To learn about asynchronous beans, go to Using asynchronous beans section of the WebSphere Application Server Information Center.

Controller bean

The controller bean is a stateless session bean defined in the compute-intensive application deployment descriptor that allows the runtime environment to control jobs for the application. The implementation of this stateless session bean is provided by the application server. The application includes the stateless session bean, shown in the following definition, in the deployment descriptor of one of its enterprise bean modules. Exactly one controller bean must be defined for each compute-intensive application. Since the implementation of the controller bean is provided in the application server runtime, application deployers do not request deployment of enterprise beans during deployment of compute-intensive applications.
<session id="supply a suitable name here">
   <ejb-name>CIController</ejb-name>
   <home>com.ibm.ws.ci.CIControllerHome</home>
   <remote>com.ibm.ws.ci.CIController</remote>
   <ejb-class>com.ibm.ws.ci.CIControllerBean</ejb-class>
   <session-type>Stateless</session-type>
   <transaction-type>Bean</transaction-type>
   <resource-ref id="WorkManager_ResourceRef">
      <description>
         WorkManager that is used to execute jobs.
      
      <res-ref-name>wm/CIWorkManager</res-ref-name>
      <res-type>commonj.work.WorkManager</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
   

Packaging a compute-intensive application

The logic for a compute-intensive application some number of CIWork objects plus the classes needed to support those CIWork objects, is packaged in an enterprise bean module in a J2EE application Enterprise Archive (EAR) file. Note that the deployment descriptor for the enterprise bean module must contain the definition of the stateless session bean previously described. If the application itself uses other enterprise beans or resources, then the definitions for those beans and resources might also appear in the deployment descriptor. You can use J2EE development tools such as IBM Rational Application Developer to develop and package compute-intensive applications in the same way that they are used to construct J2EE applications containing enterprise bean modules and asynchronous beans.

Lifecycle of a compute-intensive application

A compute-intensive application is started by the application server in exactly the same way as other J2EE applications. If the application defines any start-up beans, then those beans are run when the application server starts. When a job arrives for the application to run, the compute-intensive execution environment (GEE.ear) invokes the CIControllerBean stateless session bean defined in the application EJB module deployment descriptor. The Java Naming and Directory Interface (JNDI) name of this stateless session bean is specified in the XML Job Control Language (xJCL) for the job. For each job step, the CIControllerBean completes the following actions:
  1. Instantiates the application CIWork object specified by the class name element in the xJCL for the job step using the CIWork class's no-argument constructor.
  2. Invokes the CIWork object's setProperties() method to pass any properties defined in the xJCL for the job step.
  3. Looks up the work manager defined the enterprise bean module's deployment descriptor and uses it to asynchronously call the CIWork object's run() method.

If the job is canceled before the run() method returns, then the CIControllerBean invokes the CIWork object release() method on a separate thread. It is up to the developer of the long-running application to arrange for logic in the release() method to cause the run() method to return promptly. The job remains in a cancel pending state until the run() method returns.

If the job is not canceled and the run() method returns without returning an exception, then the job completed successfully. If the run() method returns an exception, then the job status is execution failed. After the run() method returns (either successfuly or by returning an exception), no further calls are made to the CIWork object, and all references to it are dropped.




Related concepts
The batch programming model
Related tasks
The business grid programming models
Concept topic    

Terms of Use | Feedback

Last updated: Oct 16, 2009 11:08:29 AM EDT
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r0/index.jsp?topic=/com.ibm.websphere.xd.doc/info/scheduler/cschintensve.html