public final class QueuelessExecutor extends AbstractExecutorService implements BlockingExecutorService, BoundedThreadPoolExecutorMBean, ShutdownListenable
Constructor and Description |
---|
QueuelessExecutor(ThreadFactory threadFactory,
DirectExecutor taskExecutor,
Executor handoffExecutor,
long keepAliveTime) |
Modifier and Type | Method and Description |
---|---|
<A> void |
addShutdownListener(EventListener<A> shutdownListener,
A attachment)
Add a shutdown listener.
|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
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 |
getCurrentThreadCount() |
Executor |
getHandoffExecutor() |
long |
getKeepAliveTime() |
int |
getLargestThreadCount() |
int |
getMaxThreads() |
int |
getRejectedCount() |
boolean |
isBlocking() |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
setBlocking(boolean blocking) |
void |
setHandoffExecutor(Executor handoffExecutor) |
void |
setKeepAliveTime(long milliseconds) |
void |
setMaxThreads(int newSize) |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
public QueuelessExecutor(ThreadFactory threadFactory, DirectExecutor taskExecutor, Executor handoffExecutor, long keepAliveTime)
public int getMaxThreads()
getMaxThreads
in interface ThreadPoolExecutorMBean
public void setMaxThreads(int newSize)
setMaxThreads
in interface ThreadPoolExecutorMBean
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 getLargestThreadCount()
getLargestThreadCount
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 Executor getHandoffExecutor()
public void setHandoffExecutor(Executor handoffExecutor)
public void shutdown()
shutdown
in interface ExecutorService
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
public boolean isShutdown()
isShutdown
in interface ExecutorService
public boolean isTerminated()
isTerminated
in interface ExecutorService
public void execute(Runnable task)
BlockingExecutor
execute
in interface Executor
execute
in interface BlockingExecutor
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 <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 listenerCopyright © 2012 JBoss by Red Hat. All Rights Reserved.