@ComponentProfile(summary="Split a message and then execute the associated services on the split items, aggregating the split messages afterwards", tag="service,splitjoin", since="3.7.1") public class PoolingSplitJoinService extends SplitJoinService
SplitJoinService
that uses a underlying thread and object pool to execute the service on each split message.
This service splits a message according to the configured MessageSplitter
implementation, executes the configured
Service
and subsequently joins all the messages back using the configured MessageAggregator
implementation
This differs from SplitJoinService
in that a pool of Service
instances is maintained and
re-used for each message; so the high cost of initialisation for the service, is not incurred (more than the max number of
threads specified) as much.
In the adapter configuration file this class is aliased as pooling-split-join-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
PoolingSplitJoinService() |
Modifier and Type | Method and Description |
---|---|
protected java.util.List<java.util.concurrent.Callable<AdaptrisMessage>> |
buildTasks(ServiceExceptionHandler handler,
java.util.List<AdaptrisMessage> msgs) |
void |
closeService() |
protected java.util.concurrent.ExecutorService |
createExecutor() |
java.lang.Integer |
getMaxThreads() |
java.lang.Boolean |
getWarmStart() |
void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setMaxThreads(java.lang.Integer size)
Set the max number of threads to handle the execution of the split messages.
|
void |
setWarmStart(java.lang.Boolean b)
Specify if the underlying object pool should be warmed up on
start() . |
void |
start()
Starts the component.
|
PoolingSplitJoinService |
withMaxThreads(java.lang.Integer max) |
PoolingSplitJoinService |
withWarmStart(java.lang.Boolean b) |
doService, getAggregator, getSendEvents, getService, getSplitter, getTimeout, registerEventHandler, sendEvents, sendEvents, setAggregator, setExceptionStrategy, setSendEvents, setService, setSplitter, setTimeout, wrappedServices
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
continueOnFailure, isBranching, setUniqueId
createName, createQualifier, isTrackingEndpoint
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
getUniqueId
close, init, stop
getLookupName
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
prepare
in class SplitJoinService
CoreException
public void initService() throws CoreException
initService
in class SplitJoinService
CoreException
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
start
in class ServiceImp
CoreException
- wrapping any underlying Exception
spublic void closeService()
closeService
in class SplitJoinService
protected java.util.List<java.util.concurrent.Callable<AdaptrisMessage>> buildTasks(ServiceExceptionHandler handler, java.util.List<AdaptrisMessage> msgs) throws java.lang.Exception
buildTasks
in class SplitJoinService
java.lang.Exception
protected java.util.concurrent.ExecutorService createExecutor()
createExecutor
in class SplitJoinService
public java.lang.Integer getMaxThreads()
public void setMaxThreads(java.lang.Integer size)
size
- the max number of threads, defaults to 10 if not specified.public PoolingSplitJoinService withMaxThreads(java.lang.Integer max)
public java.lang.Boolean getWarmStart()
public void setWarmStart(java.lang.Boolean b)
start()
.b
- true or false (default false if not specified).public PoolingSplitJoinService withWarmStart(java.lang.Boolean b)