Package org.apache.camel.spi
Class ThreadPoolProfile
- java.lang.Object
-
- org.apache.camel.spi.ThreadPoolProfile
-
- All Implemented Interfaces:
Serializable,Cloneable
public class ThreadPoolProfile extends Object implements Serializable, Cloneable
A profile which defines thread pool settings. See more details at threading model- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ThreadPoolProfile()Creates a new thread pool profile, with no id set.ThreadPoolProfile(String id)Creates a new thread pool profile
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaults(ThreadPoolProfile defaultProfile)Overwrites each attribute that is null with the attribute from defaultProfileThreadPoolProfileclone()BooleangetAllowCoreThreadTimeOut()Gets whether to allow core threads to timeoutStringgetId()Gets the id of this profileLonggetKeepAliveTime()Gets the keep alive time for inactive threadsIntegergetMaxPoolSize()Gets the maximum pool sizeIntegergetMaxQueueSize()Gets the maximum number of tasks in the work queue.IntegergetPoolSize()Gets the core pool size (threads to keep minimum in pool)RejectedExecutionHandlergetRejectedExecutionHandler()Gets the handler for tasks which cannot be executed by the thread pool.org.apache.camel.util.concurrent.ThreadPoolRejectedPolicygetRejectedPolicy()Gets the policy for tasks which cannot be executed by the thread pool.TimeUnitgetTimeUnit()Gets the time unit used for keep alive timeBooleanisDefaultProfile()Whether this profile is the default profile (there can only be one).booleanisEmpty()voidsetAllowCoreThreadTimeOut(Boolean allowCoreThreadTimeOut)Sets whether to allow core threads to timeoutvoidsetDefaultProfile(Boolean defaultProfile)Sets whether this profile is the default profile (there can only be one).voidsetId(String id)Sets the id of this profilevoidsetKeepAliveTime(Long keepAliveTime)Sets the keep alive time for inactive threadsvoidsetMaxPoolSize(Integer maxPoolSize)Sets the maximum pool sizevoidsetMaxQueueSize(Integer maxQueueSize)Sets the maximum number of tasks in the work queue.voidsetPoolSize(Integer poolSize)Sets the core pool size (threads to keep minimum in pool)voidsetRejectedPolicy(org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy)Sets the handler for tasks which cannot be executed by the thread pool.voidsetTimeUnit(TimeUnit timeUnit)Sets the time unit used for keep alive timeStringtoString()
-
-
-
Constructor Detail
-
ThreadPoolProfile
public ThreadPoolProfile()
Creates a new thread pool profile, with no id set.
-
ThreadPoolProfile
public ThreadPoolProfile(String id)
Creates a new thread pool profile- Parameters:
id- id of the profile
-
-
Method Detail
-
getId
public String getId()
Gets the id of this profile- Returns:
- the id of this profile
-
setId
public void setId(String id)
Sets the id of this profile- Parameters:
id- profile id
-
isDefaultProfile
public Boolean isDefaultProfile()
Whether this profile is the default profile (there can only be one).- Returns:
- true if its the default profile, false otherwise
-
setDefaultProfile
public void setDefaultProfile(Boolean defaultProfile)
Sets whether this profile is the default profile (there can only be one).- Parameters:
defaultProfile- the option
-
getPoolSize
public Integer getPoolSize()
Gets the core pool size (threads to keep minimum in pool)- Returns:
- the pool size
-
setPoolSize
public void setPoolSize(Integer poolSize)
Sets the core pool size (threads to keep minimum in pool)- Parameters:
poolSize- the pool size
-
getMaxPoolSize
public Integer getMaxPoolSize()
Gets the maximum pool size- Returns:
- the maximum pool size
-
setMaxPoolSize
public void setMaxPoolSize(Integer maxPoolSize)
Sets the maximum pool size- Parameters:
maxPoolSize- the max pool size
-
getKeepAliveTime
public Long getKeepAliveTime()
Gets the keep alive time for inactive threads- Returns:
- the keep alive time
-
setKeepAliveTime
public void setKeepAliveTime(Long keepAliveTime)
Sets the keep alive time for inactive threads- Parameters:
keepAliveTime- the keep alive time
-
getTimeUnit
public TimeUnit getTimeUnit()
Gets the time unit used for keep alive time- Returns:
- the time unit
-
setTimeUnit
public void setTimeUnit(TimeUnit timeUnit)
Sets the time unit used for keep alive time- Parameters:
timeUnit- the time unit
-
getMaxQueueSize
public Integer getMaxQueueSize()
Gets the maximum number of tasks in the work queue. Use -1 or Integer.MAX_VALUE for an unbounded queue- Returns:
- the max queue size
-
setMaxQueueSize
public void setMaxQueueSize(Integer maxQueueSize)
Sets the maximum number of tasks in the work queue. Use -1 or Integer.MAX_VALUE for an unbounded queue- Parameters:
maxQueueSize- the max queue size
-
getAllowCoreThreadTimeOut
public Boolean getAllowCoreThreadTimeOut()
Gets whether to allow core threads to timeout- Returns:
- the allow core threads to timeout
-
setAllowCoreThreadTimeOut
public void setAllowCoreThreadTimeOut(Boolean allowCoreThreadTimeOut)
Sets whether to allow core threads to timeout- Parameters:
allowCoreThreadTimeOut- true to allow timeout
-
getRejectedPolicy
public org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy getRejectedPolicy()
Gets the policy for tasks which cannot be executed by the thread pool.- Returns:
- the policy for the handler
-
getRejectedExecutionHandler
public RejectedExecutionHandler getRejectedExecutionHandler()
Gets the handler for tasks which cannot be executed by the thread pool.- Returns:
- the handler, or null if none defined
-
setRejectedPolicy
public void setRejectedPolicy(org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy)
Sets the handler for tasks which cannot be executed by the thread pool.- Parameters:
rejectedPolicy- the policy for the handler
-
addDefaults
public void addDefaults(ThreadPoolProfile defaultProfile)
Overwrites each attribute that is null with the attribute from defaultProfile- Parameters:
defaultProfile- profile with default values
-
isEmpty
public boolean isEmpty()
-
clone
public ThreadPoolProfile clone()
-
-