public final class JBossThreadPoolExecutor extends ThreadPoolExecutor implements BlockingExecutorService, BoundedQueueThreadPoolExecutorMBean, ShutdownListenable
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue) |
JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler) |
JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory) |
JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler) |
Modifier and Type | Method and Description |
---|---|
<A> void |
addShutdownListener(EventListener<A> shutdownListener,
A attachment)
Add a shutdown listener.
|
void |
execute(Runnable task)
Executes the given command at some time in the future.
|
void |
executeBlocking(Runnable task)
Execute a task, blocking until it can be accepted, or until the calling thread is interrupted.
|
void |
executeBlocking(Runnable task,
long timeout,
TimeUnit unit)
Execute a task, blocking until it can be accepted, a timeout elapses, or the calling thread is interrupted.
|
void |
executeNonBlocking(Runnable task)
Execute a task, without blocking.
|
int |
getCoreThreads() |
int |
getCurrentThreadCount() |
long |
getKeepAliveTime() |
int |
getLargestThreadCount() |
int |
getMaxThreads() |
int |
getRejectedCount() |
RejectedExecutionHandler |
getRejectedExecutionHandler() |
boolean |
isAllowCoreThreadTimeout() |
boolean |
isBlocking() |
void |
setAllowCoreThreadTimeout(boolean allow) |
void |
setBlocking(boolean blocking) |
void |
setCoreThreads(int newSize) |
void |
setKeepAliveTime(long milliseconds) |
void |
setMaxThreads(int newSize) |
void |
setRejectedExecutionHandler(RejectedExecutionHandler handler) |
protected void |
terminated() |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setThreadFactory, shutdown, shutdownNow, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)
public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)
public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler)
public JBossThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
public void execute(Runnable task)
BlockingExecutor
execute
in interface Executor
execute
in interface BlockingExecutor
execute
in class ThreadPoolExecutor
task
- the task to submitpublic void executeBlocking(Runnable task) throws RejectedExecutionException, InterruptedException
BlockingExecutor
executeBlocking
in interface BlockingExecutor
task
- the task to submitStoppedExecutorException
- if the executor was shut down before the task was acceptedThreadCreationException
- if a thread could not be created for some reasonRejectedExecutionException
- if execution is rejected for some other reasonInterruptedException
- if the current thread was interrupted before the task could be acceptedpublic void executeBlocking(Runnable task, long timeout, TimeUnit unit) throws RejectedExecutionException, InterruptedException
BlockingExecutor
executeBlocking
in interface BlockingExecutor
task
- the task to submittimeout
- the amount of time to waitunit
- the unit of timeExecutionTimedOutException
- if the timeout elapsed before a task could be acceptedStoppedExecutorException
- if the executor was shut down before the task was acceptedThreadCreationException
- if a thread could not be created for some reasonRejectedExecutionException
- if execution is rejected for some other reasonInterruptedException
- if the current thread was interrupted before the task could be acceptedpublic void executeNonBlocking(Runnable task) throws RejectedExecutionException
BlockingExecutor
executeNonBlocking
in interface BlockingExecutor
task
- the task to submitStoppedExecutorException
- if the executor was shut down before the task was acceptedThreadCreationException
- if a thread could not be created for some reasonRejectedExecutionException
- if execution is rejected for some other reasonpublic int getLargestThreadCount()
getLargestThreadCount
in interface ThreadExecutorMBean
public boolean isAllowCoreThreadTimeout()
isAllowCoreThreadTimeout
in interface BoundedQueueThreadPoolExecutorMBean
public void setAllowCoreThreadTimeout(boolean allow)
setAllowCoreThreadTimeout
in interface BoundedQueueThreadPoolExecutorMBean
public int getMaxThreads()
getMaxThreads
in interface ThreadPoolExecutorMBean
public void setMaxThreads(int newSize)
setMaxThreads
in interface ThreadPoolExecutorMBean
public int getCoreThreads()
getCoreThreads
in interface BoundedQueueThreadPoolExecutorMBean
public void setCoreThreads(int newSize)
setCoreThreads
in interface BoundedQueueThreadPoolExecutorMBean
public long getKeepAliveTime()
getKeepAliveTime
in interface ThreadPoolExecutorMBean
public void setKeepAliveTime(long milliseconds)
setKeepAliveTime
in interface ThreadPoolExecutorMBean
public int getCurrentThreadCount()
getCurrentThreadCount
in interface ThreadExecutorMBean
public int getRejectedCount()
getRejectedCount
in interface ThreadExecutorMBean
public boolean isBlocking()
isBlocking
in interface BoundedThreadPoolExecutorMBean
public void setBlocking(boolean blocking)
setBlocking
in interface BoundedThreadPoolExecutorMBean
public RejectedExecutionHandler getRejectedExecutionHandler()
getRejectedExecutionHandler
in class ThreadPoolExecutor
public void setRejectedExecutionHandler(RejectedExecutionHandler handler)
setRejectedExecutionHandler
in class ThreadPoolExecutor
public <A> void addShutdownListener(EventListener<A> shutdownListener, A attachment)
addShutdownListener
in interface ShutdownListenable
A
- the attachment typeshutdownListener
- the listenerattachment
- the attachment value to pass to the listenerprotected void terminated()
terminated
in class ThreadPoolExecutor
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.