Class QueueExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
org.jboss.threads.QueueExecutor
- All Implemented Interfaces:
Executor, ExecutorService, BlockingExecutor, BlockingExecutorService, BoundedQueueThreadPoolExecutorMBean, BoundedThreadPoolExecutorMBean, ThreadExecutorMBean, ThreadPoolExecutorMBean, ShutdownListenable
@Deprecated
public final class QueueExecutor
extends AbstractExecutorService
implements BlockingExecutorService, BoundedQueueThreadPoolExecutorMBean, ShutdownListenable
Deprecated.
An executor which uses a regular queue to hold tasks. The executor may be tuned at runtime in many ways.
-
Constructor Summary
ConstructorsConstructorDescriptionQueueExecutor(int coreThreads, int maxThreads, long keepAliveTime, TimeUnit keepAliveTimeUnit, int queueLength, ThreadFactory threadFactory, boolean blocking, Executor handoffExecutor) Deprecated.Create a new instance.QueueExecutor(int coreThreads, int maxThreads, long keepAliveTime, TimeUnit keepAliveTimeUnit, Queue<Runnable> queue, ThreadFactory threadFactory, boolean blocking, Executor handoffExecutor) Deprecated.Create a new instance.QueueExecutor(int coreThreads, int maxThreads, long keepAliveTime, TimeUnit keepAliveTimeUnit, Queue<Runnable> queue, ThreadFactory threadFactory, boolean blocking, Executor handoffExecutor, DirectExecutor taskExecutor) Deprecated.Create a new instance. -
Method Summary
Modifier and TypeMethodDescription<A> voidaddShutdownListener(EventListener<A> shutdownListener, A attachment) Deprecated.Add a shutdown listener.booleanawaitTermination(long timeout, TimeUnit unit) Deprecated.voidDeprecated.Execute a task.voidexecuteBlocking(Runnable task) Deprecated.Execute a task, blocking until it can be accepted, or until the calling thread is interrupted.voidexecuteBlocking(Runnable task, long timeout, TimeUnit unit) Deprecated.Execute a task, blocking until it can be accepted, a timeout elapses, or the calling thread is interrupted.voidexecuteNonBlocking(Runnable task) Deprecated.Execute a task, without blocking.intDeprecated.intDeprecated.Deprecated.Get the handoff executor which is called when a task cannot be accepted immediately.longDeprecated.intDeprecated.intDeprecated.intDeprecated.intDeprecated.booleanDeprecated.booleanDeprecated.Determine whether this thread pool executor is set to block when a task cannot be accepted immediately.booleanDeprecated.booleanDeprecated.voidsetAllowCoreThreadTimeout(boolean allowCoreThreadTimeout) Deprecated.voidsetBlocking(boolean blocking) Deprecated.Set whether this thread pool executor should be set to block when a task cannot be accepted immediately.voidsetCoreThreads(int coreThreads) Deprecated.voidsetHandoffExecutor(Executor handoffExecutor) Deprecated.Set the handoff executor which is called when a task cannot be accepted immediately.voidsetKeepAliveTime(long milliseconds) Deprecated.voidsetKeepAliveTime(long keepAliveTime, TimeUnit keepAliveTimeUnit) Deprecated.Set the keep-alive time to the given amount of time.voidsetMaxThreads(int maxThreads) Deprecated.voidshutdown()Deprecated.Deprecated.Methods inherited from class AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Constructor Details
-
QueueExecutor
public QueueExecutor(int coreThreads, int maxThreads, long keepAliveTime, TimeUnit keepAliveTimeUnit, Queue<Runnable> queue, ThreadFactory threadFactory, boolean blocking, Executor handoffExecutor, DirectExecutor taskExecutor) Deprecated.Create a new instance.- Parameters:
coreThreads- the number of threads to create before enqueueing tasksmaxThreads- the maximum number of threads to createkeepAliveTime- the amount of time that an idle thread should remain activekeepAliveTimeUnit- the unit of time forkeepAliveTimequeue- the queue to use for tasksthreadFactory- the thread factory to use for new threadsblocking-trueif the executor should block when the queue is full and no threads are available,falseto use the handoff executorhandoffExecutor- the executor which is called when blocking is disabled and a task cannot be accepted, ornullto reject the tasktaskExecutor- the executor to use to execute tasks
-
QueueExecutor
public QueueExecutor(int coreThreads, int maxThreads, long keepAliveTime, TimeUnit keepAliveTimeUnit, Queue<Runnable> queue, ThreadFactory threadFactory, boolean blocking, Executor handoffExecutor) Deprecated.Create a new instance.- Parameters:
coreThreads- the number of threads to create before enqueueing tasksmaxThreads- the maximum number of threads to createkeepAliveTime- the amount of time that an idle thread should remain activekeepAliveTimeUnit- the unit of time forkeepAliveTimequeue- the queue to use for tasksthreadFactory- the thread factory to use for new threadsblocking-trueif the executor should block when the queue is full and no threads are available,falseto use the handoff executorhandoffExecutor- the executor which is called when blocking is disabled and a task cannot be accepted, ornullto reject the task
-
QueueExecutor
public QueueExecutor(int coreThreads, int maxThreads, long keepAliveTime, TimeUnit keepAliveTimeUnit, int queueLength, ThreadFactory threadFactory, boolean blocking, Executor handoffExecutor) Deprecated.Create a new instance.- Parameters:
coreThreads- the number of threads to create before enqueueing tasksmaxThreads- the maximum number of threads to createkeepAliveTime- the amount of time that an idle thread should remain activekeepAliveTimeUnit- the unit of time forkeepAliveTimequeueLength- the fixed queue length to use for tasksthreadFactory- the thread factory to use for new threadsblocking-trueif the executor should block when the queue is full and no threads are available,falseto use the handoff executorhandoffExecutor- the executor which is called when blocking is disabled and a task cannot be accepted, ornullto reject the task
-
-
Method Details
-
execute
Deprecated.Execute a task.- Specified by:
executein interfaceBlockingExecutor- Specified by:
executein interfaceExecutor- Parameters:
task- the task to execute- Throws:
RejectedExecutionException- when a task is rejected by the handoff executorStoppedExecutorException- when the executor is terminatingExecutionInterruptedException- when blocking is enabled and the current thread is interrupted before a task could be accepted
-
executeBlocking
Deprecated.Execute a task, blocking until it can be accepted, or until the calling thread is interrupted.- Specified by:
executeBlockingin interfaceBlockingExecutor- Parameters:
task- the task to submit- Throws:
StoppedExecutorException- 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 acceptedNullPointerException- if command isnull
-
executeBlocking
public void executeBlocking(Runnable task, long timeout, TimeUnit unit) throws RejectedExecutionException, InterruptedException Deprecated.Execute a task, blocking until it can be accepted, a timeout elapses, or the calling thread is interrupted.- Specified by:
executeBlockingin interfaceBlockingExecutor- 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 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 acceptedNullPointerException- if command isnull
-
executeNonBlocking
Deprecated.Execute a task, without blocking.- Specified by:
executeNonBlockingin interfaceBlockingExecutor- Parameters:
task- the task to submit- Throws:
StoppedExecutorException- 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 reasonNullPointerException- if command isnull
-
shutdown
-
shutdownNow
Deprecated.- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
-
isTerminated
-
awaitTermination
Deprecated.- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
isAllowCoreThreadTimeout
public boolean isAllowCoreThreadTimeout()Deprecated.- Specified by:
isAllowCoreThreadTimeoutin interfaceBoundedQueueThreadPoolExecutorMBean
-
setAllowCoreThreadTimeout
public void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout) Deprecated.- Specified by:
setAllowCoreThreadTimeoutin interfaceBoundedQueueThreadPoolExecutorMBean
-
getCoreThreads
public int getCoreThreads()Deprecated.- Specified by:
getCoreThreadsin interfaceBoundedQueueThreadPoolExecutorMBean
-
setCoreThreads
public void setCoreThreads(int coreThreads) Deprecated.- Specified by:
setCoreThreadsin interfaceBoundedQueueThreadPoolExecutorMBean
-
getMaxThreads
public int getMaxThreads()Deprecated.- Specified by:
getMaxThreadsin interfaceThreadPoolExecutorMBean
-
setMaxThreads
public void setMaxThreads(int maxThreads) Deprecated.- Specified by:
setMaxThreadsin interfaceThreadPoolExecutorMBean
-
getKeepAliveTime
public long getKeepAliveTime()Deprecated.- Specified by:
getKeepAliveTimein interfaceThreadPoolExecutorMBean
-
setKeepAliveTime
Deprecated.Set the keep-alive time to the given amount of time.- Parameters:
keepAliveTime- the amount of timekeepAliveTimeUnit- the unit of time
-
setKeepAliveTime
public void setKeepAliveTime(long milliseconds) Deprecated.- Specified by:
setKeepAliveTimein interfaceThreadPoolExecutorMBean
-
isBlocking
public boolean isBlocking()Deprecated.Determine whether this thread pool executor is set to block when a task cannot be accepted immediately.- Specified by:
isBlockingin interfaceBoundedThreadPoolExecutorMBean- Returns:
trueif blocking is enabled,falseif the handoff executor is used
-
setBlocking
public void setBlocking(boolean blocking) Deprecated.Set whether this thread pool executor should be set to block when a task cannot be accepted immediately.- Specified by:
setBlockingin interfaceBoundedThreadPoolExecutorMBean- Parameters:
blocking-trueif blocking is enabled,falseif the handoff executor is used
-
getHandoffExecutor
Deprecated.Get the handoff executor which is called when a task cannot be accepted immediately.- Returns:
- the handoff executor
-
setHandoffExecutor
Deprecated.Set the handoff executor which is called when a task cannot be accepted immediately.- Parameters:
handoffExecutor- the handoff executor
-
addShutdownListener
Deprecated.Add a shutdown listener. If the target object is already shut down, the listener is invoked directly.- Specified by:
addShutdownListenerin interfaceShutdownListenable- Type Parameters:
A- the attachment type- Parameters:
shutdownListener- the listenerattachment- the attachment value to pass to the listener
-
getCurrentThreadCount
public int getCurrentThreadCount()Deprecated.- Specified by:
getCurrentThreadCountin interfaceThreadExecutorMBean
-
getLargestThreadCount
public int getLargestThreadCount()Deprecated.- Specified by:
getLargestThreadCountin interfaceThreadExecutorMBean
-
getRejectedCount
public int getRejectedCount()Deprecated.- Specified by:
getRejectedCountin interfaceThreadExecutorMBean
-
getQueueSize
-
EnhancedQueueExecutorinstead.