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, Map<String,Boolean> componentDebugModes)
           
 
Method Summary
 void disableDebug(Object msg)
          Remove the configured debugger.
 void enableDebug(int port, String host, boolean onerror)
          Configure a debugger.
 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)
           
 boolean getComponentDebugMode(String componentName)
          Query the debug mode of the specified component (Connector or Function Component).
 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 setComponentDebugMode(String componentName, boolean debug)
          Modify the debug mode of the specified component.
 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 Exception
Throws:
Exception

AssemblyLinePool

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

AssemblyLinePool

public AssemblyLinePool(String assemblyLine,
                        Log log,
                        RSInterface parent,
                        AssemblyLineConfig alConfig,
                        String debugHost,
                        int debugPort,
                        boolean debugOnError,
                        Map<String,Boolean> componentDebugModes)
                 throws Exception
Throws:
Exception
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()

getComponentDebugMode

public boolean getComponentDebugMode(String componentName)
                              throws Exception
Query the debug mode of the specified component (Connector or Function Component). May be called by different threads.

Parameters:
componentName - The name of the component as it appears in the configuration of the AssemblyLine.
Returns:
The debug mode of the component.
Throws:
Exception - If the component name is invalid.

setComponentDebugMode

public void setComponentDebugMode(String componentName,
                                  boolean debug)
                           throws Exception
Modify the debug mode of the specified component. May be called by different threads.

Parameters:
componentName - The name of the component.
debug - The new debug mode setting.
Throws:
Exception - If the component name is invalid.

enableDebug

public void enableDebug(int port,
                        String host,
                        boolean onerror)
                 throws Exception
Configure a debugger. May be called by other threads.

Parameters:
port - The TCP port number of the remote debugger client
host - The host name of the remote debugger client
onerror - If true breakpoints are disabled except when there is an error.
Throws:
Exception - If there is already a debugger, if the debugger cannot be initialized or if the Pool size is more than one.

disableDebug

public void disableDebug(Object msg)
Remove the configured debugger. May be called by other threads.

Parameters:
msg - Message to be sent.