|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.util.threadpool.BasicThreadPool
A basic thread pool.
Constructor Summary | |
BasicThreadPool()
Create a new thread pool |
|
BasicThreadPool(java.lang.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 (src) wrapper)
Execute a task |
protected void |
executeOnThread(TaskWrapper (src) wrapper)
Execute a task on the same thread |
BlockingMode (src) |
getBlockingMode()
|
ThreadPool (src) |
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 |
java.lang.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 |
java.lang.String |
getThreadGroupName()
Retrieve the thread group name |
void |
run(java.lang.Runnable runnable)
Run a runnable |
void |
run(java.lang.Runnable runnable,
long startTimeout,
long completeTimeout)
|
void |
runTask(Task (src) task)
Run a task |
void |
runTaskWrapper(TaskWrapper (src) wrapper)
Run a task wrapper |
void |
setBlockingMode(BlockingMode (src) mode)
Set the behavior of the pool when a task is added and the queue is full. |
void |
setBlockingMode(java.lang.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(java.lang.String name)
Set the thread pool name |
void |
setThreadGroupName(java.lang.String threadGroupName)
Set the thread group name |
void |
stop()
Stop the thread pool |
void |
stop(boolean immediate)
Stop the pool |
java.lang.String |
toString()
|
protected void |
waitForTask(TaskWrapper (src) 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(java.lang.String name)
name
- the pool nameMethod Detail |
public void stop(boolean immediate)
ThreadPool (src)
stop
in interface ThreadPool (src)
immediate
- whether to shutdown immediatelypublic void waitForTasks() throws java.lang.InterruptedException
ThreadPool (src)
waitForTasks
in interface ThreadPool (src)
java.lang.InterruptedException
public void waitForTasks(long maxWaitTime) throws java.lang.InterruptedException
ThreadPool (src)
waitForTasks
in interface ThreadPool (src)
maxWaitTime
-
java.lang.InterruptedException
public void runTaskWrapper(TaskWrapper (src) wrapper)
ThreadPool (src)
runTaskWrapper
in interface ThreadPool (src)
wrapper
- the task wrapperpublic void runTask(Task (src) task)
ThreadPool (src)
runTask
in interface ThreadPool (src)
task
- the taskpublic void run(java.lang.Runnable runnable)
ThreadPool (src)
run
in interface ThreadPool (src)
runnable
- the runnablepublic void run(java.lang.Runnable runnable, long startTimeout, long completeTimeout)
run
in interface ThreadPool (src)
runnable
- startTimeout
- completeTimeout
- public java.lang.String getName()
ThreadPoolMBean (src)
getName
in interface ThreadPoolMBean (src)
public void setName(java.lang.String name)
ThreadPoolMBean (src)
setName
in interface ThreadPoolMBean (src)
name
- the namepublic int getPoolNumber()
ThreadPoolMBean (src)
getPoolNumber
in interface ThreadPoolMBean (src)
public java.lang.String getThreadGroupName()
BasicThreadPoolMBean (src)
getThreadGroupName
in interface BasicThreadPoolMBean (src)
public void setThreadGroupName(java.lang.String threadGroupName)
BasicThreadPoolMBean (src)
setThreadGroupName
in interface BasicThreadPoolMBean (src)
threadGroupName
- - the thread group namepublic int getQueueSize()
BasicThreadPoolMBean (src)
getQueueSize
in interface BasicThreadPoolMBean (src)
public int getMaximumQueueSize()
BasicThreadPoolMBean (src)
getMaximumQueueSize
in interface BasicThreadPoolMBean (src)
public void setMaximumQueueSize(int size)
BasicThreadPoolMBean (src)
setMaximumQueueSize
in interface BasicThreadPoolMBean (src)
size
- the new maximum queue sizepublic int getPoolSize()
public int getMinimumPoolSize()
ThreadPoolMBean (src)
getMinimumPoolSize
in interface ThreadPoolMBean (src)
public void setMinimumPoolSize(int size)
ThreadPoolMBean (src)
setMinimumPoolSize
in interface ThreadPoolMBean (src)
size
- the minimum pool sizepublic int getMaximumPoolSize()
ThreadPoolMBean (src)
getMaximumPoolSize
in interface ThreadPoolMBean (src)
public void setMaximumPoolSize(int size)
ThreadPoolMBean (src)
setMaximumPoolSize
in interface ThreadPoolMBean (src)
size
- the maximum pool sizepublic long getKeepAliveTime()
BasicThreadPoolMBean (src)
getKeepAliveTime
in interface BasicThreadPoolMBean (src)
public void setKeepAliveTime(long time)
BasicThreadPoolMBean (src)
setKeepAliveTime
in interface BasicThreadPoolMBean (src)
time
- the keep alive timepublic BlockingMode (src) getBlockingMode()
getBlockingMode
in interface BasicThreadPoolMBean (src)
public void setBlockingMode(BlockingMode (src) mode)
BasicThreadPoolMBean (src)
setBlockingMode
in interface BasicThreadPoolMBean (src)
mode
- one of run, wait, discard, discardOldest or abort without
regard to case.public void setBlockingMode(java.lang.String name)
name
- - the string form of the mode enumpublic ThreadPool (src) getInstance()
ThreadPoolMBean (src)
getInstance
in interface ThreadPoolMBean (src)
public void stop()
ThreadPoolMBean (src)
stop
in interface ThreadPoolMBean (src)
public java.lang.String toString()
protected void executeOnThread(TaskWrapper (src) wrapper)
wrapper
- the task wrapperprotected void execute(TaskWrapper (src) wrapper)
wrapper
- the task wrapperprotected void waitForTask(TaskWrapper (src) wrapper)
wrapper
- the task wrapperprotected void checkTimeoutMonitor()
protected org.jboss.util.threadpool.BasicThreadPool.TimeoutInfo getNextTimeout()
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |