@Metadata(label="eip,routing") public class ThreadsDefinition extends OutputDefinition<ThreadsDefinition> implements ExecutorServiceAwareDefinition<ThreadsDefinition>
outputs
inheritErrorHandler, 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 the caller should run the task when it was rejected by the thread pool.
|
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 |
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, setOutputs
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, bean, bean, bean, bean, beanRef, beanRef, beanRef, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, createOutputsProcessorImpl, createProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrichRef, enrichRef, enrichRef, filter, filter, filter, filter, getIndex, getInterceptStrategies, getOtherAttributes, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, isTopLevelOnly, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, 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, pollEnrichRef, pollEnrichRef, preCreateProcessor, process, process, processRef, recipientList, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, sample, script, script, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, startupOrder, stop, threads, threads, threads, threads, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
description, description, getCustomId, getDescription, getDescriptionText, getId, getShortName, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setId
public ThreadsDefinition()
public Processor createProcessor(RouteContext routeContext) throws Exception
ProcessorDefinition
createProcessor
in class ProcessorDefinition<ThreadsDefinition>
Exception
protected ThreadPoolRejectedPolicy resolveRejectedPolicy(RouteContext routeContext)
public String getLabel()
ProcessorDefinition
getLabel
in interface NamedNode
getLabel
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 Registry
public 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()
ExecutorServiceAware
getExecutorService
in interface ExecutorServiceAware
public void setExecutorService(ExecutorService executorService)
ExecutorServiceAware
setExecutorService
in interface ExecutorServiceAware
executorService
- the executorpublic String getExecutorServiceRef()
ExecutorServiceAware
Registry
for the executor service to be used.getExecutorServiceRef
in interface ExecutorServiceAware
public void setExecutorServiceRef(String executorServiceRef)
ExecutorServiceAware
Registry
for the executor service to be used.setExecutorServiceRef
in interface ExecutorServiceAware
executorServiceRef
- 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