com.ibm.di.server
Class AssemblyLinePool

java.lang.Object
  extended by com.ibm.di.server.AssemblyLinePool

public final class AssemblyLinePool
extends Object

This class implements a pool of AssemblyLines. The purpose of this pool is to make using AssemblyLines more efficient by re-using AssemblyLine objects. This pool is especially useful when Server mode Connectors are used in an AssemblyLine. By configuring a pool of AssemblyLines it is possible to speed up the processing of requests directed at a Server mode Connector, because each request can be serviced by a different AssesmblyLine from the pool. Moreover when a request has been processed by an AssemblyLine object that object does not have to terminate (thus wasting system resources on AssemblyLine termination) but is returned to the pool to be used for servicing other requests.


Nested Class Summary
 class AssemblyLinePool.ALWorker
          This is the worker thread that drives a client request.
 
Field Summary
static int TM_NEWAL_EVENT
           
static int TM_NEWAL_THREAD
           
static int TM_REUSE_AL
           
 
Constructor Summary
AssemblyLinePool(String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig)
           
AssemblyLinePool(String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig, int debugPort)
           
AssemblyLinePool(String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig, String debugHost, int debugPort, boolean debugOnError)
           
 
Method Summary
 Entry executeEvent(Thread source, Entry event)
          Called by a thread to execute a cycle in the AssemblyLine
 Entry executeEvent(Thread source, Entry event, boolean processTCB)
           
 long getConnectorPoolTimeout()
          Returns the connector pool timeout in milliseconds.
 RSInterface getParent()
           
 boolean hasRunningThreads()
          Returns true if there are active eventhandlers using this ALPool as interceptor.
 void releaseAssemblyLine(Thread owner)
          Called by a thread to release its reserved AssemblyLine instance.
 boolean runtimeConnectorTypeExcluded(ConnectorInterface connector)
          Returns true if the connector type is excluded from pooling.
 void setConnectorPoolTimeout(long connectorPoolTimeout)
          Sets the connector pool timeout in milliseconds.
 AssemblyLinePool.ALWorker startThread(String name, ConnectorConfig config)
          Starts a new thread with the provided connector config.
 AssemblyLinePool.ALWorker startThread(String name, ConnectorInterface iterator)
          Starts a new thread with the provided Iterator.
 AssemblyLinePool.ALWorker startThread(String name, Entry workEntry)
          Starts a new thread with the provided work entry.
 void terminate()
          Called to block future calls from EventHandlers from executing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TM_NEWAL_THREAD

public static final int TM_NEWAL_THREAD
See Also:
Constant Field Values

TM_NEWAL_EVENT

public static final int TM_NEWAL_EVENT
See Also:
Constant Field Values

TM_REUSE_AL

public static final int TM_REUSE_AL
See Also:
Constant Field Values
Constructor Detail

AssemblyLinePool

public AssemblyLinePool(String assemblyLine,
                        Log log,
                        RSInterface parent,
                        AssemblyLineConfig alConfig)
                 throws Throwable
Throws:
Throwable

AssemblyLinePool

public AssemblyLinePool(String assemblyLine,
                        Log log,
                        RSInterface parent,
                        AssemblyLineConfig alConfig,
                        int debugPort)
                 throws Throwable
Throws:
Throwable

AssemblyLinePool

public AssemblyLinePool(String assemblyLine,
                        Log log,
                        RSInterface parent,
                        AssemblyLineConfig alConfig,
                        String debugHost,
                        int debugPort,
                        boolean debugOnError)
                 throws Throwable
Throws:
Throwable
Method Detail

startThread

public AssemblyLinePool.ALWorker startThread(String name,
                                             ConnectorInterface iterator)
                                      throws Exception
Starts a new thread with the provided Iterator. This method is typically called from the AssemblyLine containing a Server mode connector. The server mode connector returns a connector interface that is used to handle a "client" request of some kind. The thread started will insert the connector as the sole iterator and drive the AssemblyLine instance until the connector returns EOF.

Throws:
Exception

startThread

public AssemblyLinePool.ALWorker startThread(String name,
                                             ConnectorConfig config)
                                      throws Exception
Starts a new thread with the provided connector config. This method is typically called when a server mode connector is being started in its own thread.

Throws:
Exception

startThread

public AssemblyLinePool.ALWorker startThread(String name,
                                             Entry workEntry)
                                      throws Exception
Starts a new thread with the provided work entry. This method is typically called to execute an AL instance with a single work entry.

Throws:
Exception

releaseAssemblyLine

public void releaseAssemblyLine(Thread owner)
Called by a thread to release its reserved AssemblyLine instance.

Parameters:
owner - The Thread object that previously called executeEvent)

getConnectorPoolTimeout

public long getConnectorPoolTimeout()
Returns the connector pool timeout in milliseconds.


setConnectorPoolTimeout

public void setConnectorPoolTimeout(long connectorPoolTimeout)
Sets the connector pool timeout in milliseconds.


runtimeConnectorTypeExcluded

public boolean runtimeConnectorTypeExcluded(ConnectorInterface connector)
Returns true if the connector type is excluded from pooling.


hasRunningThreads

public boolean hasRunningThreads()
Returns true if there are active eventhandlers using this ALPool as interceptor.


executeEvent

public Entry executeEvent(Thread source,
                          Entry event)
                   throws Exception
Called by a thread to execute a cycle in the AssemblyLine

Parameters:
source - The caller's thread object
event - The entry passed as the initial work entry
Throws:
Exception

executeEvent

public Entry executeEvent(Thread source,
                          Entry event,
                          boolean processTCB)
                   throws Exception
Throws:
Exception

terminate

public void terminate()
Called to block future calls from EventHandlers from executing. When an EH calls this ALPool after this method has completed, an exception is thrown to end the eventhandler.


getParent

public RSInterface getParent()