|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.util.threadpool.BasicThreadPool
A basic thread pool.
Constructor Summary | |
BasicThreadPool()
Create a new thread pool |
|
BasicThreadPool(String name)
Create a new thread pool with a default queue size of 1024, min/max pool sizes of 100 and a keep alive of 60 seconds. |
Method Summary | |
protected void |
checkTimeoutMonitor()
Used to lazily create the task completion timeout thread and monitor |
protected void |
execute(TaskWrapper wrapper)
Execute a task |
protected void |
executeOnThread(TaskWrapper wrapper)
Execute a task on the same thread |
BlockingMode |
getBlockingMode()
|
ThreadPool |
getInstance()
Get the instance |
long |
getKeepAliveTime()
Get the keep alive time |
int |
getMaximumPoolSize()
Get the maximum pool size |
int |
getMaximumQueueSize()
Get the maximum queue size |
int |
getMinimumPoolSize()
Get the minimum pool size |
String |
getName()
Get the thread pool name |
protected org.jboss.util.threadpool.BasicThreadPool.TimeoutInfo |
getNextTimeout()
|
int |
getPoolNumber()
Get the internal pool number |
int |
getPoolSize()
|
int |
getQueueSize()
Get the current queue size |
String |
getThreadGroupName()
Retrieve the thread group name |
void |
run(Runnable runnable)
Run a runnable |
void |
run(Runnable runnable,
long startTimeout,
long completeTimeout)
|
void |
runTask(Task task)
Run a task |
void |
runTaskWrapper(TaskWrapper wrapper)
Run a task wrapper |
void |
setBlockingMode(BlockingMode mode)
Set the behavior of the pool when a task is added and the queue is full. |
void |
setBlockingMode(String name)
For backward compatibility with the previous string based mode |
void |
setKeepAliveTime(long time)
Set the keep alive time |
void |
setMaximumPoolSize(int size)
Set the maximum pool size |
void |
setMaximumQueueSize(int size)
Set the maximum queue size |
void |
setMinimumPoolSize(int size)
Set the minimum pool size |
void |
setName(String name)
Set the thread pool name |
void |
setThreadGroupName(String threadGroupName)
Set the thread group name |
void |
stop()
Stop the thread pool |
void |
stop(boolean immediate)
Stop the pool |
String |
toString()
|
protected void |
waitForTask(TaskWrapper wrapper)
Wait for a task |
void |
waitForTasks()
Wait on the queued tasks to complete. |
void |
waitForTasks(long maxWaitTime)
Wait on the queued tasks to complete upto maxWaitTime milliseconds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BasicThreadPool()
public BasicThreadPool(String name)
name
- the pool nameMethod Detail |
public void stop(boolean immediate)
ThreadPool
stop
in interface ThreadPool
immediate
- whether to shutdown immediatelypublic void waitForTasks() throws InterruptedException
ThreadPool
waitForTasks
in interface ThreadPool
InterruptedException
public void waitForTasks(long maxWaitTime) throws InterruptedException
ThreadPool
waitForTasks
in interface ThreadPool
maxWaitTime
-
InterruptedException
public void runTaskWrapper(TaskWrapper wrapper)
ThreadPool
runTaskWrapper
in interface ThreadPool
wrapper
- the task wrapperpublic void runTask(Task task)
ThreadPool
runTask
in interface ThreadPool
task
- the taskpublic void run(Runnable runnable)
ThreadPool
run
in interface ThreadPool
runnable
- the runnablepublic void run(Runnable runnable, long startTimeout, long completeTimeout)
run
in interface ThreadPool
runnable
- startTimeout
- completeTimeout
- public String getName()
ThreadPoolMBean
getName
in interface ThreadPoolMBean
public void setName(String name)
ThreadPoolMBean
setName
in interface ThreadPoolMBean
name
- the namepublic int getPoolNumber()
ThreadPoolMBean
getPoolNumber
in interface ThreadPoolMBean
public String getThreadGroupName()
BasicThreadPoolMBean
getThreadGroupName
in interface BasicThreadPoolMBean
public void setThreadGroupName(String threadGroupName)
BasicThreadPoolMBean
setThreadGroupName
in interface BasicThreadPoolMBean
threadGroupName
- - the thread group namepublic int getQueueSize()
BasicThreadPoolMBean
getQueueSize
in interface BasicThreadPoolMBean
public int getMaximumQueueSize()
BasicThreadPoolMBean
getMaximumQueueSize
in interface BasicThreadPoolMBean
public void setMaximumQueueSize(int size)
BasicThreadPoolMBean
setMaximumQueueSize
in interface BasicThreadPoolMBean
size
- the new maximum queue sizepublic int getPoolSize()
public int getMinimumPoolSize()
ThreadPoolMBean
getMinimumPoolSize
in interface ThreadPoolMBean
public void setMinimumPoolSize(int size)
ThreadPoolMBean
setMinimumPoolSize
in interface ThreadPoolMBean
size
- the minimum pool sizepublic int getMaximumPoolSize()
ThreadPoolMBean
getMaximumPoolSize
in interface ThreadPoolMBean
public void setMaximumPoolSize(int size)
ThreadPoolMBean
setMaximumPoolSize
in interface ThreadPoolMBean
size
- the maximum pool sizepublic long getKeepAliveTime()
BasicThreadPoolMBean
getKeepAliveTime
in interface BasicThreadPoolMBean
public void setKeepAliveTime(long time)
BasicThreadPoolMBean
setKeepAliveTime
in interface BasicThreadPoolMBean
time
- the keep alive timepublic BlockingMode getBlockingMode()
getBlockingMode
in interface BasicThreadPoolMBean
public void setBlockingMode(BlockingMode mode)
BasicThreadPoolMBean
setBlockingMode
in interface BasicThreadPoolMBean
mode
- one of run, wait, discard, discardOldest or abort without
regard to case.public void setBlockingMode(String name)
name
- - the string form of the mode enumpublic ThreadPool getInstance()
ThreadPoolMBean
getInstance
in interface ThreadPoolMBean
public void stop()
ThreadPoolMBean
stop
in interface ThreadPoolMBean
public String toString()
protected void executeOnThread(TaskWrapper wrapper)
wrapper
- the task wrapperprotected void execute(TaskWrapper wrapper)
wrapper
- the task wrapperprotected void waitForTask(TaskWrapper wrapper)
wrapper
- the task wrapperprotected void checkTimeoutMonitor()
protected org.jboss.util.threadpool.BasicThreadPool.TimeoutInfo getNextTimeout()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |