public abstract class AbstractManagedExecutorService extends AbstractExecutorService implements javax.enterprise.concurrent.ManagedExecutorService
ManagedExecutorService
and
ManagedScheduledExecutorService
implementation classes. Lifecycle operations are available for use by the
application server. Application components should be handed instances
that extends from AbstractManagedExecutorServiceAdapter instead, which have
their lifecycle operations disabled.
Instances of subclasses of this class could be used by the Java EE
product provider to control the life cycle.Modifier and Type | Class and Description |
---|---|
static class |
AbstractManagedExecutorService.RejectPolicy |
Modifier and Type | Field and Description |
---|---|
protected ContextServiceImpl |
contextService |
protected ContextSetupProvider |
contextSetupProvider |
protected boolean |
contextualCallback |
protected boolean |
longRunningTasks |
protected ManagedThreadFactoryImpl |
managedThreadFactory |
protected String |
name |
protected AbstractManagedExecutorService.RejectPolicy |
rejectPolicy |
Constructor and Description |
---|
AbstractManagedExecutorService(String name,
ManagedThreadFactoryImpl managedThreadFactory,
long hungTaskThreshold,
boolean longRunningTasks,
ContextServiceImpl contextService,
ContextSetupProvider contextCallback,
AbstractManagedExecutorService.RejectPolicy rejectPolicy) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
protected <T> T |
doInvokeAny(Collection<? extends Callable<T>> tasks,
boolean timed,
long nanos) |
abstract void |
execute(Runnable command) |
protected void |
executeManagedFutureTask(ManagedFutureTask<?> task)
Executes a ManagedFutureTask created by getNewTaskFor()
|
abstract long |
getCompletedTaskCount()
Returns the approximate total number of tasks that have
completed execution.
|
javax.enterprise.concurrent.ContextService |
getContextService() |
ContextSetupProvider |
getContextSetupProvider() |
abstract javax.enterprise.concurrent.ManagedExecutorService |
getExecutorForTaskListener()
Returns the ManagedExecutorService instance that is used for passing
as the executor argument of ManagedTaskListener calls
|
Collection<AbstractManagedThread> |
getHungThreads() |
ManagedThreadFactoryImpl |
getManagedThreadFactory() |
String |
getName() |
protected abstract <V> ManagedFutureTask<V> |
getNewTaskFor(Callable<V> callable)
newTaskFor from super class java.util.concurrent.AbstractExecutorService
is protected access.
|
protected abstract <V> ManagedFutureTask<V> |
getNewTaskFor(Runnable r,
V result)
newTaskFor from super class java.util.concurrent.AbstractExecutorService
is protected access.
|
String |
getObjectName() |
AbstractManagedExecutorService.RejectPolicy |
getRejectPolicy() |
abstract long |
getTaskCount()
Returns the approximate total number of tasks that have ever been
scheduled for execution.
|
protected abstract ExecutorService |
getThreadPoolExecutor() |
Collection<AbstractManagedThread> |
getThreads()
Return an array of threads in this Managed[Scheduled]ExecutorService
|
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
boolean |
isContextualCallback() |
boolean |
isEventProvider() |
boolean |
isLongRunningTasks() |
boolean |
isShutdown() |
boolean |
isStateManageable() |
boolean |
isStatisticsProvider() |
boolean |
isTerminated() |
protected <T> RunnableFuture<T> |
newTaskFor(Callable<T> callable) |
protected <T> RunnableFuture<T> |
newTaskFor(Runnable r,
T result) |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
protected final String name
protected final ContextSetupProvider contextSetupProvider
protected final ContextServiceImpl contextService
protected final ManagedThreadFactoryImpl managedThreadFactory
protected AbstractManagedExecutorService.RejectPolicy rejectPolicy
protected final boolean contextualCallback
protected boolean longRunningTasks
public AbstractManagedExecutorService(String name, ManagedThreadFactoryImpl managedThreadFactory, long hungTaskThreshold, boolean longRunningTasks, ContextServiceImpl contextService, ContextSetupProvider contextCallback, AbstractManagedExecutorService.RejectPolicy rejectPolicy)
protected <T> T doInvokeAny(Collection<? extends Callable<T>> tasks, boolean timed, long nanos) throws InterruptedException, ExecutionException, TimeoutException
public ContextSetupProvider getContextSetupProvider()
public javax.enterprise.concurrent.ContextService getContextService()
public boolean isContextualCallback()
public Collection<AbstractManagedThread> getHungThreads()
public ManagedThreadFactoryImpl getManagedThreadFactory()
public String getName()
public boolean isLongRunningTasks()
public AbstractManagedExecutorService.RejectPolicy getRejectPolicy()
public String getObjectName()
public Collection<AbstractManagedThread> getThreads()
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll
in interface ExecutorService
invokeAll
in class AbstractExecutorService
InterruptedException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll
in interface ExecutorService
invokeAll
in class AbstractExecutorService
InterruptedException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny
in interface ExecutorService
invokeAny
in class AbstractExecutorService
InterruptedException
ExecutionException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny
in interface ExecutorService
invokeAny
in class AbstractExecutorService
InterruptedException
ExecutionException
TimeoutException
public boolean isEventProvider()
public boolean isStateManageable()
public boolean isStatisticsProvider()
public Future<?> submit(Runnable task)
submit
in interface ExecutorService
submit
in class AbstractExecutorService
RejectedExecutionException
NullPointerException
public <T> Future<T> submit(Runnable task, T result)
submit
in interface ExecutorService
submit
in class AbstractExecutorService
RejectedExecutionException
NullPointerException
public <T> Future<T> submit(Callable<T> task)
submit
in interface ExecutorService
submit
in class AbstractExecutorService
RejectedExecutionException
NullPointerException
protected abstract ExecutorService getThreadPoolExecutor()
protected void executeManagedFutureTask(ManagedFutureTask<?> task)
task
- The ManagedFutureTask to be runpublic boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public boolean isShutdown()
isShutdown
in interface ExecutorService
public boolean isTerminated()
isTerminated
in interface ExecutorService
public void shutdown()
shutdown
in interface ExecutorService
public List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
protected abstract <V> ManagedFutureTask<V> getNewTaskFor(Runnable r, V result)
protected abstract <V> ManagedFutureTask<V> getNewTaskFor(Callable<V> callable)
protected <T> RunnableFuture<T> newTaskFor(Runnable r, T result)
newTaskFor
in class AbstractExecutorService
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
newTaskFor
in class AbstractExecutorService
public abstract javax.enterprise.concurrent.ManagedExecutorService getExecutorForTaskListener()
public abstract long getTaskCount()
public abstract long getCompletedTaskCount()
Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.