Package com.ibm.di.server
Class AssemblyLinePool
- java.lang.Object
-
- com.ibm.di.server.AssemblyLinePool
-
public final class AssemblyLinePool extends java.lang.ObjectThis 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
Nested Classes Modifier and Type Class Description classAssemblyLinePool.ALWorkerThis is the worker thread that drives a client request.
-
Field Summary
Fields Modifier and Type Field Description static intTM_NEWAL_EVENTstatic intTM_NEWAL_THREADstatic intTM_REUSE_AL
-
Constructor Summary
Constructors Constructor Description AssemblyLinePool(java.lang.String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig)AssemblyLinePool(java.lang.String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig, int debugPort)AssemblyLinePool(java.lang.String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig, java.lang.String debugHost, int debugPort, boolean debugOnError, java.util.Map<java.lang.String,java.lang.Boolean> componentDebugModes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableDebug(java.lang.Object msg)Remove the configured debugger.voidenableDebug(int port, java.lang.String host, boolean onerror)Configure a debugger.EntryexecuteEvent(java.lang.Thread source, Entry event)Called by a thread to execute a cycle in the AssemblyLineEntryexecuteEvent(java.lang.Thread source, Entry event, boolean processTCB)java.util.List<AssemblyLine>getActiveAssemblyLines()booleangetComponentDebugMode(java.lang.String componentName)Query the debug mode of the specified component (Connector or Function Component).longgetConnectorPoolTimeout()Returns the connector pool timeout in milliseconds.RSInterfacegetParent()booleanhasRunningThreads()Returns true if there are active eventhandlers using this ALPool as interceptor.voidreleaseAssemblyLine(java.lang.Thread owner)Called by a thread to release its reserved AssemblyLine instance.booleanruntimeConnectorTypeExcluded(ConnectorInterface connector)Returns true if the connector type is excluded from pooling.voidsetComponentDebugMode(java.lang.String componentName, boolean debug)Modify the debug mode of the specified component.voidsetConnectorPoolTimeout(long connectorPoolTimeout)Sets the connector pool timeout in milliseconds.AssemblyLinePool.ALWorkerstartThread(java.lang.String name, ConnectorConfig config)Starts a new thread with the provided connector config.AssemblyLinePool.ALWorkerstartThread(java.lang.String name, ConnectorInterface iterator)Starts a new thread with the provided Iterator.AssemblyLinePool.ALWorkerstartThread(java.lang.String name, Entry workEntry)Starts a new thread with the provided work entry.voidterminate()Called to block future calls from EventHandlers from executing.
-
-
-
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(java.lang.String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig) throws java.lang.Exception- Throws:
java.lang.Exception
-
AssemblyLinePool
public AssemblyLinePool(java.lang.String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig, int debugPort) throws java.lang.Exception- Throws:
java.lang.Exception
-
AssemblyLinePool
public AssemblyLinePool(java.lang.String assemblyLine, Log log, RSInterface parent, AssemblyLineConfig alConfig, java.lang.String debugHost, int debugPort, boolean debugOnError, java.util.Map<java.lang.String,java.lang.Boolean> componentDebugModes) throws java.lang.Exception- Throws:
java.lang.Exception
-
-
Method Detail
-
startThread
public AssemblyLinePool.ALWorker startThread(java.lang.String name, ConnectorInterface iterator) throws java.lang.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:
java.lang.Exception
-
startThread
public AssemblyLinePool.ALWorker startThread(java.lang.String name, ConnectorConfig config) throws java.lang.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:
java.lang.Exception
-
startThread
public AssemblyLinePool.ALWorker startThread(java.lang.String name, Entry workEntry) throws java.lang.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:
java.lang.Exception
-
releaseAssemblyLine
public void releaseAssemblyLine(java.lang.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(java.lang.Thread source, Entry event) throws java.lang.Exception
Called by a thread to execute a cycle in the AssemblyLine- Parameters:
source- The caller's thread objectevent- The entry passed as the initial work entry- Throws:
java.lang.Exception
-
executeEvent
public Entry executeEvent(java.lang.Thread source, Entry event, boolean processTCB) throws java.lang.Exception
- Throws:
java.lang.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(java.lang.String componentName) throws java.lang.ExceptionQuery 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:
java.lang.Exception- If the component name is invalid.
-
setComponentDebugMode
public void setComponentDebugMode(java.lang.String componentName, boolean debug) throws java.lang.ExceptionModify 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:
java.lang.Exception- If the component name is invalid.
-
enableDebug
public void enableDebug(int port, java.lang.String host, boolean onerror) throws java.lang.ExceptionConfigure a debugger. May be called by other threads.- Parameters:
port- The TCP port number of the remote debugger clienthost- The host name of the remote debugger clientonerror- If true breakpoints are disabled except when there is an error.- Throws:
java.lang.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(java.lang.Object msg)
Remove the configured debugger. May be called by other threads.- Parameters:
msg- Message to be sent.
-
getActiveAssemblyLines
public java.util.List<AssemblyLine> getActiveAssemblyLines()
-
-