@Metadata(label="eip,routing") public class ThreadsDefinition extends OutputDefinition<ThreadsDefinition> implements ExecutorServiceAwareDefinition<ThreadsDefinition>
outputsinheritErrorHandler, log| Constructor and Description |
|---|
ThreadsDefinition() |
| Modifier and Type | Method and Description |
|---|---|
ThreadsDefinition |
allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
Whether idle core threads is allowed to timeout and therefore can shrink the pool size below the core pool size
Is by default false
|
ThreadsDefinition |
callerRunsWhenRejected(boolean callerRunsWhenRejected)
Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full).
|
Processor |
createProcessor(RouteContext routeContext)
Override this in definition class and implement logic to create the processor
based on the definition model.
|
ThreadsDefinition |
executorService(ExecutorService executorService)
To use a custom thread pool
|
ThreadsDefinition |
executorServiceRef(String executorServiceRef)
To refer to a custom thread pool or use a thread pool profile (as overlay)
|
Boolean |
getAllowCoreThreadTimeOut() |
Boolean |
getCallerRunsWhenRejected() |
ExecutorService |
getExecutorService()
Gets the executor service
|
String |
getExecutorServiceRef()
Gets the reference to lookup in the
Registry for the executor service to be used. |
Long |
getKeepAliveTime() |
String |
getLabel()
Returns a label to describe this node such as the expression if some kind of expression node
|
Integer |
getMaxPoolSize() |
Integer |
getMaxQueueSize() |
Integer |
getPoolSize() |
ThreadPoolRejectedPolicy |
getRejectedPolicy() |
String |
getShortName()
Returns a short name for this node which can be useful for ID generation or referring to related resources like images
|
String |
getThreadName() |
TimeUnit |
getTimeUnit() |
ThreadsDefinition |
keepAliveTime(long keepAliveTime)
Sets the keep alive time for idle threads
|
ThreadsDefinition |
maxPoolSize(int maxPoolSize)
Sets the maximum pool size
|
ThreadsDefinition |
maxQueueSize(int maxQueueSize)
Sets the maximum number of tasks in the work queue.
|
ThreadsDefinition |
poolSize(int poolSize)
Sets the core pool size
|
ThreadsDefinition |
rejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy)
Sets the handler for tasks which cannot be executed by the thread pool.
|
protected ThreadPoolRejectedPolicy |
resolveRejectedPolicy(RouteContext routeContext) |
void |
setAllowCoreThreadTimeOut(Boolean allowCoreThreadTimeOut) |
void |
setCallerRunsWhenRejected(Boolean callerRunsWhenRejected) |
void |
setExecutorService(ExecutorService executorService)
Sets the executor service to be used.
|
void |
setExecutorServiceRef(String executorServiceRef)
Sets a reference to lookup in the
Registry for the executor service to be used. |
void |
setKeepAliveTime(Long keepAliveTime) |
void |
setMaxPoolSize(Integer maxPoolSize) |
void |
setMaxQueueSize(Integer maxQueueSize) |
void |
setPoolSize(Integer poolSize) |
void |
setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy) |
void |
setThreadName(String threadName) |
void |
setTimeUnit(TimeUnit timeUnit) |
ThreadsDefinition |
threadName(String threadName)
Sets the thread name to use.
|
ThreadsDefinition |
timeUnit(TimeUnit keepAliveTimeUnits)
Sets the keep alive time unit.
|
String |
toString() |
getOutputs, isOutputSupported, setOutputsaddInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, bean, bean, bean, bean, beanRef, beanRef, beanRef, beanRef, beanRef, choice, claimCheck, claimCheck, claimCheck, claimCheck, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, createOutputsProcessorImpl, createProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endHystrix, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrichRef, enrichRef, enrichRef, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getIndex, getInterceptStrategies, getOtherAttributes, getParent, hystrix, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, isTopLevelOnly, isWrappingEntireOutput, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, loopDoWhile, loopDoWhile, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, placeholder, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, pollEnrichRef, pollEnrichWith, pollEnrichWith, pollEnrichWith, preCreateProcessor, process, process, process, processRef, recipientList, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setHeader, setInheritErrorHandler, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, startupOrder, stop, threads, threads, threads, threads, throttle, throttle, throttle, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, toD, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapChannel, wrapInErrorHandler, wrapProcessordescription, description, getCustomId, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setIdpublic ThreadsDefinition()
public Processor createProcessor(RouteContext routeContext) throws Exception
ProcessorDefinitioncreateProcessor in class ProcessorDefinition<ThreadsDefinition>Exceptionprotected ThreadPoolRejectedPolicy resolveRejectedPolicy(RouteContext routeContext)
public String getShortName()
NamedNodegetShortName in interface NamedNodegetShortName in class OutputDefinition<ThreadsDefinition>public String getLabel()
ProcessorDefinitiongetLabel in interface NamedNodegetLabel in class ProcessorDefinition<ThreadsDefinition>public String toString()
toString in class OutputDefinition<ThreadsDefinition>public ThreadsDefinition executorService(ExecutorService executorService)
executorService in interface ExecutorServiceAwareDefinition<ThreadsDefinition>executorService - the executor servicepublic ThreadsDefinition executorServiceRef(String executorServiceRef)
executorServiceRef in interface ExecutorServiceAwareDefinition<ThreadsDefinition>executorServiceRef - reference for a ExecutorService
to lookup in the Registrypublic ThreadsDefinition poolSize(int poolSize)
poolSize - the core pool size to keep minimum in the poolpublic ThreadsDefinition maxPoolSize(int maxPoolSize)
maxPoolSize - the maximum pool sizepublic ThreadsDefinition keepAliveTime(long keepAliveTime)
keepAliveTime - keep alive timepublic ThreadsDefinition timeUnit(TimeUnit keepAliveTimeUnits)
keepAliveTimeUnits - time unitpublic ThreadsDefinition maxQueueSize(int maxQueueSize)
maxQueueSize - the max queue sizepublic ThreadsDefinition rejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy)
rejectedPolicy - the policy for the handlerpublic ThreadsDefinition threadName(String threadName)
threadName - the thread namepublic ThreadsDefinition callerRunsWhenRejected(boolean callerRunsWhenRejected)
callerRunsWhenRejected - whether or not the caller should runpublic ThreadsDefinition allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
allowCoreThreadTimeOut - true to allow timeoutpublic ExecutorService getExecutorService()
ExecutorServiceAwaregetExecutorService in interface ExecutorServiceAwarepublic void setExecutorService(ExecutorService executorService)
ExecutorServiceAwaresetExecutorService in interface ExecutorServiceAwareexecutorService - the executorpublic String getExecutorServiceRef()
ExecutorServiceAwareRegistry for the executor service to be used.getExecutorServiceRef in interface ExecutorServiceAwarepublic void setExecutorServiceRef(String executorServiceRef)
ExecutorServiceAwareRegistry for the executor service to be used.setExecutorServiceRef in interface ExecutorServiceAwareexecutorServiceRef - reference for the executorpublic Integer getPoolSize()
public void setPoolSize(Integer poolSize)
public Integer getMaxPoolSize()
public void setMaxPoolSize(Integer maxPoolSize)
public Long getKeepAliveTime()
public void setKeepAliveTime(Long keepAliveTime)
public TimeUnit getTimeUnit()
public void setTimeUnit(TimeUnit timeUnit)
public Integer getMaxQueueSize()
public void setMaxQueueSize(Integer maxQueueSize)
public String getThreadName()
public void setThreadName(String threadName)
public ThreadPoolRejectedPolicy getRejectedPolicy()
public void setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy)
public Boolean getCallerRunsWhenRejected()
public void setCallerRunsWhenRejected(Boolean callerRunsWhenRejected)
public Boolean getAllowCoreThreadTimeOut()
public void setAllowCoreThreadTimeOut(Boolean allowCoreThreadTimeOut)
Apache Camel