Modifier and Type | Method and Description |
---|---|
int |
getCoreSize()
Returns the core pool size.
|
long |
getKeepAlive()
Gets the keep alive time.
|
int |
getMaximumSize()
Returns the maximum pool size.
|
String |
getName()
Gets the definition name.
|
int |
getQueueSize()
Returns the queue size.
|
String |
getRejectionHandlerClass()
Returns the rejection handler class name.
|
void |
setCoreSize(int size)
Sets the core pool size.
|
void |
setKeepAlive(long keepAliveTime)
Sets the keep alive time.
|
void |
setMaximumSize(int size)
Sets the maximum pool size.
|
void |
setQueueSize(int size)
Sets the queue size.
|
void |
setRejectionHandlerClass(String className)
Sets the rejection handler class name.
|
String getName()
void setCoreSize(int size) throws ConfigException
The core number of threads to have running in the thread pool. Whenever a thread is required a new one will be created until this number is reached, even if there are idle threads already in the pool.
If this is not specified then 5 is assumed.
size
- core pool sizeConfigException
- if unable to set the propertyint getCoreSize()
void setMaximumSize(int size) throws ConfigException
The maximum number of threads that may be created in the thread pool before tasks are queued. Such threads are released immediately after execution.
If this is not specified then 10 is assumed.
size
- the maximum pool sizeConfigException
- if unable to set the propertyint getMaximumSize()
void setQueueSize(int size) throws ConfigException
The queue size. When the max-size is reached then tasks will be queued. If the value is zero then the queue is unbounded. If not 0 then the value must be at least 10.
If this is not specified then 2000 is assumed.
size
- the queue sizeConfigException
- if unable to set the propertyint getQueueSize()
void setKeepAlive(long keepAliveTime) throws ConfigException
Specifies the amount of time to keep inactive threads alive for. This would not apply to core threads.
If this is not specified then 0 is assumed.
keepAliveTime
- the number of milliseconds to keep inactive threads
alive for.ConfigException
- if unable to set the property.long getKeepAlive()
void setRejectionHandlerClass(String className) throws ConfigException
This may be specified to handle tasks that are rejected by the thread pool because it is completely exhausted. If this Is not specified then a default rejection policy is used so that rejected tasks are executed in the calling thread.
className
- the rejection handler class name which must represent a
class of type
ThreadPoolRejectionHandler
.ConfigException
- if unable to set the propertyString getRejectionHandlerClass()
Copyright © 2020 Push Technology Ltd. All Rights Reserved.