org.jboss.threads
Class JBossThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.jboss.threads.JBossThreadPoolExecutor
- All Implemented Interfaces:
- Executor, ExecutorService, BlockingExecutor, BlockingExecutorService, BoundedQueueThreadPoolExecutorMBean, BoundedThreadPoolExecutorMBean, ThreadExecutorMBean, ThreadPoolExecutorMBean, ShutdownListenable
public final class JBossThreadPoolExecutor
- extends ThreadPoolExecutor
- implements BlockingExecutorService, BoundedQueueThreadPoolExecutorMBean, ShutdownListenable
Constructor Summary |
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)
|
Methods inherited from class java.util.concurrent.ThreadPoolExecutor |
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 |
Methods inherited from interface java.util.concurrent.ExecutorService |
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit |
JBossThreadPoolExecutor
public JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue)
JBossThreadPoolExecutor
public JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory)
JBossThreadPoolExecutor
public JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler)
JBossThreadPoolExecutor
public JBossThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue,
ThreadFactory threadFactory,
RejectedExecutionHandler handler)
execute
public void execute(Runnable task)
- Description copied from interface:
BlockingExecutor
- Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread,
or in the calling thread, at the discretion of the Executor implementation. The call may block
or not block, depending on the configuration of the executor.
- Specified by:
execute
in interface Executor
- Specified by:
execute
in interface BlockingExecutor
- Overrides:
execute
in class ThreadPoolExecutor
- Parameters:
task
- the task to submit
executeBlocking
public void executeBlocking(Runnable task)
throws RejectedExecutionException,
InterruptedException
- Description copied from interface:
BlockingExecutor
- Execute a task, blocking until it can be accepted, or until the calling thread is interrupted.
- Specified by:
executeBlocking
in interface BlockingExecutor
- Parameters:
task
- the task to submit
- Throws:
StoppedExecutorException
- if the executor was shut down before the task was accepted
ThreadCreationException
- if a thread could not be created for some reason
RejectedExecutionException
- if execution is rejected for some other reason
InterruptedException
- if the current thread was interrupted before the task could be accepted
executeBlocking
public void executeBlocking(Runnable task,
long timeout,
TimeUnit unit)
throws RejectedExecutionException,
InterruptedException
- Description copied from interface:
BlockingExecutor
- Execute a task, blocking until it can be accepted, a timeout elapses, or the calling thread is interrupted.
- Specified by:
executeBlocking
in interface BlockingExecutor
- Parameters:
task
- the task to submittimeout
- the amount of time to waitunit
- the unit of time
- Throws:
ExecutionTimedOutException
- if the timeout elapsed before a task could be accepted
StoppedExecutorException
- if the executor was shut down before the task was accepted
ThreadCreationException
- if a thread could not be created for some reason
RejectedExecutionException
- if execution is rejected for some other reason
InterruptedException
- if the current thread was interrupted before the task could be accepted
executeNonBlocking
public void executeNonBlocking(Runnable task)
throws RejectedExecutionException
- Description copied from interface:
BlockingExecutor
- Execute a task, without blocking.
- Specified by:
executeNonBlocking
in interface BlockingExecutor
- Parameters:
task
- the task to submit
- Throws:
StoppedExecutorException
- if the executor was shut down before the task was accepted
ThreadCreationException
- if a thread could not be created for some reason
RejectedExecutionException
- if execution is rejected for some other reason
getLargestThreadCount
public int getLargestThreadCount()
- Specified by:
getLargestThreadCount
in interface ThreadExecutorMBean
isAllowCoreThreadTimeout
public boolean isAllowCoreThreadTimeout()
- Specified by:
isAllowCoreThreadTimeout
in interface BoundedQueueThreadPoolExecutorMBean
setAllowCoreThreadTimeout
public void setAllowCoreThreadTimeout(boolean allow)
- Specified by:
setAllowCoreThreadTimeout
in interface BoundedQueueThreadPoolExecutorMBean
getMaxThreads
public int getMaxThreads()
- Specified by:
getMaxThreads
in interface ThreadPoolExecutorMBean
setMaxThreads
public void setMaxThreads(int newSize)
- Specified by:
setMaxThreads
in interface ThreadPoolExecutorMBean
getCoreThreads
public int getCoreThreads()
- Specified by:
getCoreThreads
in interface BoundedQueueThreadPoolExecutorMBean
setCoreThreads
public void setCoreThreads(int newSize)
- Specified by:
setCoreThreads
in interface BoundedQueueThreadPoolExecutorMBean
getKeepAliveTime
public long getKeepAliveTime()
- Specified by:
getKeepAliveTime
in interface ThreadPoolExecutorMBean
setKeepAliveTime
public void setKeepAliveTime(long milliseconds)
- Specified by:
setKeepAliveTime
in interface ThreadPoolExecutorMBean
getCurrentThreadCount
public int getCurrentThreadCount()
- Specified by:
getCurrentThreadCount
in interface ThreadExecutorMBean
getRejectedCount
public int getRejectedCount()
- Specified by:
getRejectedCount
in interface ThreadExecutorMBean
isBlocking
public boolean isBlocking()
- Specified by:
isBlocking
in interface BoundedThreadPoolExecutorMBean
setBlocking
public void setBlocking(boolean blocking)
- Specified by:
setBlocking
in interface BoundedThreadPoolExecutorMBean
getRejectedExecutionHandler
public RejectedExecutionHandler getRejectedExecutionHandler()
- Overrides:
getRejectedExecutionHandler
in class ThreadPoolExecutor
setRejectedExecutionHandler
public void setRejectedExecutionHandler(RejectedExecutionHandler handler)
- Overrides:
setRejectedExecutionHandler
in class ThreadPoolExecutor
addShutdownListener
public <A> void addShutdownListener(EventListener<A> shutdownListener,
A attachment)
- Add a shutdown listener. If the target object is already shut down, the listener is invoked directly.
- Specified by:
addShutdownListener
in interface ShutdownListenable
- Type Parameters:
A
- the attachment type- Parameters:
shutdownListener
- the listenerattachment
- the attachment value to pass to the listener
terminated
protected void terminated()
- Overrides:
terminated
in class ThreadPoolExecutor
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.