Class HostPublisher.ParallelHPIO
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class HostPublisher.ParallelHPIO

Object
   |
   +----HostPublisher.ParallelHPIO

public class ParallelHPIO
extends Object

ParallelHPIO is a JavaBean which allows you to invoke two or more Host Publisher Integration Objects in parallel. This is useful if multiple Integration Objects can run independent of each other (meaning that one object does not depend on the output or state of another, such as through Integration Object chaining), allowing the objects to be invoked at the same time.

You simply give an instance of ParallelHPIO pointers to each Integration Object you want to run, then tell it to run them. It will return once all Integration Objects have completed.

This class only works with Host Publisher generated Integration Objects, but can easily be modified to invoke any kind of object in parallel.

Example

The most common implementation of ParallelHPIO JavaBean will be on a JSP page. To use the bean, follow these steps.

  1. Download the ParallelHPIO.jar file and add it to your CLASSPATH for the Host Publisher Studio's environment. For example:
    CLASSPATH=%CLASSPATH%;c:\hostpub\studio\ParallelHPIO.jar
  2. Within your Host Publisher Studio application, import an Integration Object from the File menu. Locate this JAR file and click OK.
  3. You'll be asked to identify this bean's inputs, outputs, and execution method. You won't actually make use of any of these, so you can click OK without specifying anything.
  4. On the page where you want to add the ParallelHPIO bean, place the cursor in the location where the bean is to be located, click the right mouse button and select Insert Integration Object.
  5. Select ParallelHPIO as the object to insert and keep clicking Next until you can click Finish.
  6. All of the objects that should be invoked in parallel, as well as the ParallelHPIO bean should be on the page now. You must now remove the calls to doHPTransaction() for each individual Integration Object. These calls will be made by ParallelHPIO.
  7. Add the appropriate calls to the ParallelHPIO object to properly run all of the Integration Objects in parallel:
     <BEAN NAME="HAParallelTest" TYPE="IntegrationObject.HAParallelTest" INTROSPECT="yes" CREATE="yes" SCOPE="request"></BEAN>
     <BEAN NAME="HAParallelTest2" TYPE="IntegrationObject.HAParallelTest" INTROSPECT="yes" CREATE="yes" SCOPE="request"></BEAN>
     <BEAN NAME="HAParallelTest3" TYPE="IntegrationObject.HAParallelTest" INTROSPECT="yes" CREATE="yes" SCOPE="request"></BEAN>
     <BEAN NAME="ParallelHPIO" TYPE="HostPublisher.ParallelHPIO" INTROSPECT="yes" CREATE="yes" SCOPE="request"></BEAN>
     <% 
        ParallelHPIO.setSessionInfo(request, response);
        ParallelHPIO.addIO(HAParallelTest);
        ParallelHPIO.addIO(HAParallelTest2);
        ParallelHPIO.addIO(HAParallelTest3);
        ParallelHPIO.runIOs(); %>
     
  8. When you transfer the application to the server, you might get a complaint that ParallelHPIO.macro could not be found. You can ignore this error.
  9. Deploy the application and try it out. For Host Access Integration Objects, you can switch on the Terminal trace option under Host Connection Tracing to see all of the terminal windows opening in parallel.

Note that the Integration Objects must be able to be run in parallel. Make sure that if pooling is turned on that the pool is configured with a high enough maximum for the number of connections to support parallelism. Also be careful of chained Integration Objects running in parallel that might be dependent on another's state before starting.

NOTE: This object and source is provided AS IS as a productivity aid to customers. While feedback is welcome and encouraged, IBM is in no way obligated to support or service this feature. The source is provided so that you may make modifications as appropriate. Feedback may be provided through the Internet newsgroup ibm.software.hostpubv2 on news.software.ibm.com.


Constructor Index

 o HostPublisher.ParallelHPIO()
Constructor.

Method Index

 o addIO(HPubCommon)
Adds an Integration Object instance to a vector of objects.
 o runIOs()
Invokes Integration Objects as they appear in the list (populated by calls to addIOs()) by generating a thread for each Integration Object which invokes that object's doHPTransaction() method.
 o setSessionInfo(HttpServletRequest, HttpServletResponse)

Provides ParallelHPIO with the HttpServletResponse and HttpServletRequest objects to use when invoking the Integration Objects.

Constructors

 o ParallelHPIO
public ParallelHPIO()
Constructor.

Methods

 o addIO
public void addIO(HPubCommon io)
Adds an Integration Object instance to a vector of objects.

Parameters:
io - An instance of an Integration Object to add to the list.
 o runIOs
public void runIOs()
Invokes Integration Objects as they appear in the list (populated by calls to addIOs()) by generating a thread for each Integration Object which invokes that object's doHPTransaction() method. The threads are all started and stored in a list. The status of each thread in the list is checked until all threads have stopped, then this call returns.

 o setSessionInfo
public void setSessionInfo(HttpServletRequest req,
                           HttpServletResponse res)

Provides ParallelHPIO with the HttpServletResponse and HttpServletRequest objects to use when invoking the Integration Objects. Integration Objects are invoked by calling their doHPTransaction() method, which requires these objects as input.

The same objects are used for every Integration Object invocation.

These objects are created and maintained by WebSphere.

Parameters:
req - The HttpServletRequest object.
res - The HttpServletResponse object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index