JBoss Threads 2.0.0.GA

org.jboss.threads
Class JBossExecutors

java.lang.Object
  extended by org.jboss.threads.JBossExecutors

public final class JBossExecutors
extends Object

JBoss thread- and executor-related utility and factory methods.


Method Summary
static RejectedExecutionHandler abortPolicy()
          Get the abort policy for a ThreadPoolExecutor.
static BlockingExecutor blockingDirectExecutor()
          Get an executor which executes tasks in the current thread, which implements BlockingExecutor.
static BlockingExecutor blockingDiscardingExecutor()
          Get an executor which discards all tasks, which implements BlockingExecutor.
static BlockingExecutor blockingRejectingExecutor()
          Get an executor which rejects all tasks, which implements BlockingExecutor.
static RejectedExecutionHandler callerRunsPolicy()
          Get the caller-runs policy for a ThreadPoolExecutor.
static Runnable classLoaderPreservingTask(Runnable delegate)
          Create a task that delegates to the given task, preserving the context classloader which was in effect when this method was invoked.
static DirectExecutor cleanupExecutor(DirectExecutor delegate, Runnable cleaner)
          Create an executor which runs the given cleanup task after running its given task.
static Runnable compositeTask(Collection<Runnable> runnables)
          Create a task that is a composite of several other tasks.
static Runnable compositeTask(Runnable... runnables)
          Create a task that is a composite of several other tasks.
static DirectExecutor contextClassLoaderExecutor(DirectExecutor delegate, ClassLoader taskClassLoader)
          Create a direct executor which runs tasks with the given context class loader.
static Runnable contextClassLoaderResetter()
          Get a Runnable which, when executed, clears the thread context class loader (if the caller has sufficient privileges).
static DependencyTaskBuilder dependencyTaskBuilder(Executor executor, Runnable task)
          Create a builder for a dependent task.
static BlockingExecutor directBlockingExecutor(DirectExecutor delegate)
          An executor which delegates to the given direct executor, but implements the blocking executor interface.
static DirectExecutor directExecutor()
          Get the direct executor.
static DirectExecutorService directExecutorService()
          Get the direct executor service.
static DirectExecutor discardingExecutor()
          Get the discarding executor.
static DirectExecutorService discardingExecutorService()
          Get the discarding executor service.
static RejectedExecutionHandler discardOldestPolicy()
          Get the discard-oldest policy for a ThreadPoolExecutor.
static RejectedExecutionHandler discardPolicy()
          Get the discard policy for a ThreadPoolExecutor.
static DirectExecutor exceptionLoggingExecutor(DirectExecutor delegate)
          Create a direct executor which consumes and logs errors that are thrown to the default thread error category "org.jboss.threads.errors".
static DirectExecutor exceptionLoggingExecutor(DirectExecutor delegate, org.jboss.logging.Logger log)
          Create a direct executor which consumes and logs errors that are thrown.
static DirectExecutor exceptionLoggingExecutor(DirectExecutor delegate, org.jboss.logging.Logger log, org.jboss.logging.Logger.Level level)
          Create a direct executor which consumes and logs errors that are thrown.
static void executeUninterruptibly(Executor executor, Runnable task)
          Execute a task uninterruptibly.
static Executor executor(WrappingExecutor delegate, DirectExecutor taskWrapper)
          An executor which delegates to a wrapping executor, wrapping each task in a task wrapper.
static Runnable executorTask(DirectExecutor executor, Runnable task)
          Get a task that runs the given task through the given direct executor.
static RejectedExecutionHandler handoffPolicy(Executor target)
          Get a handoff policy for a ThreadPoolExecutor.
static DirectExecutor initializingExecutor(DirectExecutor delegate, Runnable initializer)
          Create an executor which runs the given initialization task before running its given task.
static Thread.UncaughtExceptionHandler loggingExceptionHandler()
          Get an uncaught exception handler which logs to the default error logger.
static Thread.UncaughtExceptionHandler loggingExceptionHandler(org.jboss.logging.Logger log)
          Get an uncaught exception handler which logs to the given logger.
static Thread.UncaughtExceptionHandler loggingExceptionHandler(String categoryName)
          Get an uncaught exception handler which logs to the given logger.
static
<A> DirectExecutor
notifyingDirectExecutor(DirectExecutor delegate, TaskNotifier<Runnable,? super A> notifier, A attachment)
          Get a notifying direct executor.
static
<R extends Runnable,A>
Runnable
notifyingRunnable(R task, TaskNotifier<? super R,? super A> notifier, A attachment)
          Get a notifying runnable wrapper for a task.
static Runnable nullRunnable()
          Get the null runnable which does nothing.
static DirectExecutor privilegedExecutor(DirectExecutor delegate)
          Create a direct executor which runs with the privileges given by the current access control context.
static DirectExecutor privilegedExecutor(DirectExecutor delegate, AccessControlContext context)
          Create a direct executor which runs with the privileges given by the supplied AccessControlContext instance.
static DirectExecutor privilegedExecutor(DirectExecutor delegate, Class<?> targetClass)
          Create a direct executor which runs with the privileges given by the supplied class' protection domain.
static BlockingExecutor protectedBlockingExecutor(BlockingExecutor target)
           
static BlockingExecutorService protectedBlockingExecutorService(BlockingExecutor target)
          Wrap a blocking executor with an BlockingExecutorService instance which supports all the features of BlockingExecutorService except for shutting down the executor.
static DirectExecutorService protectedDirectExecutorService(DirectExecutor target)
          Wrap a direct executor with an DirectExecutorService instance which supports all the features of ExecutorService except for shutting down the executor.
static ExecutorService protectedExecutorService(Executor target)
          Wrap an executor with an ExecutorService instance which supports all the features of ExecutorService except for shutting down the executor.
static ScheduledExecutorService protectedScheduledExecutorService(ScheduledExecutorService target)
          Wrap a scheduled executor with a ScheduledExecutorService instance which supports all the features of ScheduledExecutorService except for shutting down the executor.
static DirectExecutor rejectingExecutor()
          Get the rejecting executor.
static DirectExecutor rejectingExecutor(String message)
          Get a rejecting executor.
static DirectExecutorService rejectingExecutorService()
          Get the rejecting executor service.
static DirectExecutorService rejectingExecutorService(String message)
          Get the rejecting executor service.
static DirectExecutor resettingExecutor(DirectExecutor delegate)
          Create a direct executor which delegates tasks to the given executor, and then clears all thread-local data after each task completes (regardless of outcome).
static ThreadFactory resettingThreadFactory(ThreadFactory delegate)
          Create a thread factory which resets all thread-local storage and delegates to the given thread factory.
static
<R extends Runnable,A>
void
run(R task, DirectExecutor directExecutor, TaskNotifier<? super R,? super A> notifier, A attachment)
          Run a task through the given direct executor, invoking the given notifier with the given attachment.
static
<R extends Runnable,A>
void
run(R task, TaskNotifier<? super R,? super A> notifier, A attachment)
          Run a task, invoking the given notifier with the given attachment.
static BlockingExecutor threadFactoryExecutor(ThreadFactory factory)
          Create an executor that executes each task in a new thread.
static BlockingExecutor threadFactoryExecutor(ThreadFactory factory, int maxThreads)
          Create an executor that executes each task in a new thread.
static BlockingExecutor threadFactoryExecutor(ThreadFactory factory, int maxThreads, boolean blocking)
          Create an executor that executes each task in a new thread.
static BlockingExecutor threadFactoryExecutor(ThreadFactory factory, int maxThreads, boolean blocking, DirectExecutor taskExecutor)
          Create an executor that executes each task in a new thread.
static DirectExecutor threadFormattedNameExecutor(DirectExecutor delegate, String newName)
          Create a direct executor which changes the thread name for the duration of a task using a formatted name.
static Runnable threadLocalResetter()
          Get a Runnable which, when executed, clears the thread-local storage of the calling thread.
static DirectExecutor threadNameExecutor(DirectExecutor delegate, String newName)
          Create a direct executor which changes the thread name for the duration of a task.
static DirectExecutor threadNameNotateExecutor(DirectExecutor delegate, String notation)
          Create a direct executor which adds a note to the thread name for the duration of a task.
static Executor uninterruptibleExecutor(Executor delegate)
          Get an executor which executes tasks uninterruptibly in the event of blocking.
static Executor wrappingExecutor(DirectExecutor taskWrapper, Executor delegate)
          An executor which delegates to another executor, wrapping each task in a task wrapper.
static WrappingExecutor wrappingExecutor(Executor delegate)
          Create a wrapping executor for a delegate executor which creates an executorTask(DirectExecutor, Runnable) for each task.
static ThreadFactory wrappingThreadFactory(DirectExecutor taskWrapper, ThreadFactory delegate)
          Creates a thread factory which executes the thread task via the given task wrapping executor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

directExecutor

public static DirectExecutor directExecutor()
Get the direct executor. This executor will immediately run any task it is given, and propagate back any run-time exceptions thrown.

Returns:
the direct executor instance

directExecutorService

public static DirectExecutorService directExecutorService()
Get the direct executor service. This executor will immediately run any task it is given, and propagate back any run-time exceptions thrown. It cannot be shut down.

Returns:
the direct executor service instance

rejectingExecutor

public static DirectExecutor rejectingExecutor()
Get the rejecting executor. This executor will reject any task submitted to it.

Returns:
the rejecting executor instance

rejectingExecutor

public static DirectExecutor rejectingExecutor(String message)
Get a rejecting executor. This executor will reject any task submitted to it with the given message.

Parameters:
message - the reject message
Returns:
the rejecting executor instance

rejectingExecutorService

public static DirectExecutorService rejectingExecutorService()
Get the rejecting executor service. This executor will reject any task submitted to it. It cannot be shut down.

Returns:
the rejecting executor service instance

rejectingExecutorService

public static DirectExecutorService rejectingExecutorService(String message)
Get the rejecting executor service. This executor will reject any task submitted to it with the given message. It cannot be shut down.

Parameters:
message - the reject message
Returns:
the rejecting executor service instance

discardingExecutor

public static DirectExecutor discardingExecutor()
Get the discarding executor. This executor will silently discard any task submitted to it.

Returns:
the discarding executor instance

discardingExecutorService

public static DirectExecutorService discardingExecutorService()
Get the discarding executor service. This executor will silently discard any task submitted to it. It cannot be shut down.

Returns:
the discarding executor service instance

privilegedExecutor

public static DirectExecutor privilegedExecutor(DirectExecutor delegate,
                                                AccessControlContext context)
Create a direct executor which runs with the privileges given by the supplied AccessControlContext instance.

Parameters:
delegate - the executor to delegate to at the privileged level
context - the AccessControlContext to use
Returns:
the new direct executor

privilegedExecutor

public static DirectExecutor privilegedExecutor(DirectExecutor delegate,
                                                Class<?> targetClass)
                                         throws SecurityException
Create a direct executor which runs with the privileges given by the supplied class' protection domain.

Parameters:
delegate - the executor to delegate to at the privileged level
targetClass - the target class whose protection domain should be used
Returns:
the new direct executor
Throws:
SecurityException - if there is a security manager installed and the caller lacks the "getProtectionDomain" RuntimePermission

privilegedExecutor

public static DirectExecutor privilegedExecutor(DirectExecutor delegate)
Create a direct executor which runs with the privileges given by the current access control context.

Parameters:
delegate - the executor to delegate to at the privileged level
Returns:
the new direct executor

contextClassLoaderExecutor

public static DirectExecutor contextClassLoaderExecutor(DirectExecutor delegate,
                                                        ClassLoader taskClassLoader)
Create a direct executor which runs tasks with the given context class loader.

Parameters:
delegate - the executor to delegate to
taskClassLoader - the context class loader to use
Returns:
the new direct executor

threadNameExecutor

public static DirectExecutor threadNameExecutor(DirectExecutor delegate,
                                                String newName)
Create a direct executor which changes the thread name for the duration of a task.

Parameters:
delegate - the executor to delegate to
newName - the thread name to use
Returns:
the new direct executor

threadFormattedNameExecutor

public static DirectExecutor threadFormattedNameExecutor(DirectExecutor delegate,
                                                         String newName)
Create a direct executor which changes the thread name for the duration of a task using a formatted name. The thread must be a JBossThread.

Parameters:
delegate - the executor to delegate to
newName - the thread name to use
Returns:
the new direct executor

threadNameNotateExecutor

public static DirectExecutor threadNameNotateExecutor(DirectExecutor delegate,
                                                      String notation)
Create a direct executor which adds a note to the thread name for the duration of a task.

Parameters:
delegate - the executor to delegate to
notation - the note to use
Returns:
the new direct executor

exceptionLoggingExecutor

public static DirectExecutor exceptionLoggingExecutor(DirectExecutor delegate,
                                                      org.jboss.logging.Logger log)
Create a direct executor which consumes and logs errors that are thrown.

Parameters:
delegate - the executor to delegate to
log - the logger to which exceptions are written at the error level
Returns:
the new direct executor

exceptionLoggingExecutor

public static DirectExecutor exceptionLoggingExecutor(DirectExecutor delegate,
                                                      org.jboss.logging.Logger log,
                                                      org.jboss.logging.Logger.Level level)
Create a direct executor which consumes and logs errors that are thrown.

Parameters:
delegate - the executor to delegate to
log - the logger to which exceptions are written
level - the level at which to log exceptions
Returns:
the new direct executor

exceptionLoggingExecutor

public static DirectExecutor exceptionLoggingExecutor(DirectExecutor delegate)
Create a direct executor which consumes and logs errors that are thrown to the default thread error category "org.jboss.threads.errors".

Parameters:
delegate - the executor to delegate to
Returns:
the new direct executor

resettingExecutor

public static DirectExecutor resettingExecutor(DirectExecutor delegate)
                                        throws SecurityException
Create a direct executor which delegates tasks to the given executor, and then clears all thread-local data after each task completes (regardless of outcome). You must have the RuntimePermission("modifyThread") permission to use this method.

Parameters:
delegate - the delegate direct executor
Returns:
a resetting executor
Throws:
SecurityException - if the caller does not have the RuntimePermission("modifyThread") permission

initializingExecutor

public static DirectExecutor initializingExecutor(DirectExecutor delegate,
                                                  Runnable initializer)
Create an executor which runs the given initialization task before running its given task.

Parameters:
delegate - the delegate direct executor
initializer - the initialization task
Returns:
an initializing executor

cleanupExecutor

public static DirectExecutor cleanupExecutor(DirectExecutor delegate,
                                             Runnable cleaner)
Create an executor which runs the given cleanup task after running its given task.

Parameters:
delegate - the delegate direct executor
cleaner - the cleanup task
Returns:
an initializing executor

blockingDirectExecutor

public static BlockingExecutor blockingDirectExecutor()
Get an executor which executes tasks in the current thread, which implements BlockingExecutor.

Returns:
the blocking direct executor

blockingDiscardingExecutor

public static BlockingExecutor blockingDiscardingExecutor()
Get an executor which discards all tasks, which implements BlockingExecutor.

Returns:
the executor

blockingRejectingExecutor

public static BlockingExecutor blockingRejectingExecutor()
Get an executor which rejects all tasks, which implements BlockingExecutor.

Returns:
the executor

wrappingExecutor

public static Executor wrappingExecutor(DirectExecutor taskWrapper,
                                        Executor delegate)
An executor which delegates to another executor, wrapping each task in a task wrapper.

Parameters:
taskWrapper - the task wrapper
delegate - the delegate executor
Returns:
a wrapping executor

directBlockingExecutor

public static BlockingExecutor directBlockingExecutor(DirectExecutor delegate)
An executor which delegates to the given direct executor, but implements the blocking executor interface. Since direct executors always execute tasks in the current thread, no blocking is possible; therefore the methods of BlockingExecutors always succeed or fail instantly.

Parameters:
delegate - the delegate direct executor
Returns:
the blocking executor

wrappingExecutor

public static WrappingExecutor wrappingExecutor(Executor delegate)
Create a wrapping executor for a delegate executor which creates an executorTask(DirectExecutor, Runnable) for each task.

Parameters:
delegate - the delegate executor
Returns:
the wrapping executor

executor

public static Executor executor(WrappingExecutor delegate,
                                DirectExecutor taskWrapper)
An executor which delegates to a wrapping executor, wrapping each task in a task wrapper.

Parameters:
delegate - the delegate executor
taskWrapper - the task wrapper
Returns:
a wrapping executor

threadFactoryExecutor

public static BlockingExecutor threadFactoryExecutor(ThreadFactory factory)
Create an executor that executes each task in a new thread.

Parameters:
factory - the thread factory to use
Returns:
the executor

threadFactoryExecutor

public static BlockingExecutor threadFactoryExecutor(ThreadFactory factory,
                                                     int maxThreads)
Create an executor that executes each task in a new thread. By default up to the given number of threads may run concurrently, after which new tasks will be rejected.

Parameters:
factory - the thread factory to use
maxThreads - the maximum number of allowed threads
Returns:
the executor

threadFactoryExecutor

public static BlockingExecutor threadFactoryExecutor(ThreadFactory factory,
                                                     int maxThreads,
                                                     boolean blocking)
Create an executor that executes each task in a new thread. By default up to the given number of threads may run concurrently, after which the caller will block or new tasks will be rejected, according to the setting of the blocking parameter.

Parameters:
factory - the thread factory to use
maxThreads - the maximum number of allowed threads
blocking - true if the submitter should block when the maximum number of threads has been reached
Returns:
the executor

threadFactoryExecutor

public static BlockingExecutor threadFactoryExecutor(ThreadFactory factory,
                                                     int maxThreads,
                                                     boolean blocking,
                                                     DirectExecutor taskExecutor)
Create an executor that executes each task in a new thread. By default up to the given number of threads may run concurrently, after which the caller will block or new tasks will be rejected, according to the setting of the blocking parameter.

Parameters:
factory - the thread factory to use
maxThreads - the maximum number of allowed threads
blocking - true if the submitter should block when the maximum number of threads has been reached
taskExecutor - the executor which should run each task
Returns:
the executor

abortPolicy

public static RejectedExecutionHandler abortPolicy()
Get the abort policy for a ThreadPoolExecutor.

Returns:
the abort policy
See Also:
ThreadPoolExecutor.AbortPolicy

callerRunsPolicy

public static RejectedExecutionHandler callerRunsPolicy()
Get the caller-runs policy for a ThreadPoolExecutor.

Returns:
the caller-runs policy
See Also:
ThreadPoolExecutor.CallerRunsPolicy

discardOldestPolicy

public static RejectedExecutionHandler discardOldestPolicy()
Get the discard-oldest policy for a ThreadPoolExecutor.

Returns:
the discard-oldest policy
See Also:
ThreadPoolExecutor.DiscardOldestPolicy

discardPolicy

public static RejectedExecutionHandler discardPolicy()
Get the discard policy for a ThreadPoolExecutor.

Returns:
the discard policy
See Also:
ThreadPoolExecutor.DiscardPolicy

handoffPolicy

public static RejectedExecutionHandler handoffPolicy(Executor target)
Get a handoff policy for a ThreadPoolExecutor. The returned instance will delegate to another executor in the event that the task is rejected.

Parameters:
target - the target executor
Returns:
the new handoff policy implementation

protectedBlockingExecutor

public static BlockingExecutor protectedBlockingExecutor(BlockingExecutor target)

protectedExecutorService

public static ExecutorService protectedExecutorService(Executor target)
Wrap an executor with an ExecutorService instance which supports all the features of ExecutorService except for shutting down the executor.

Parameters:
target - the target executor
Returns:
the executor service

protectedDirectExecutorService

public static DirectExecutorService protectedDirectExecutorService(DirectExecutor target)
Wrap a direct executor with an DirectExecutorService instance which supports all the features of ExecutorService except for shutting down the executor.

Parameters:
target - the target executor
Returns:
the executor service

protectedScheduledExecutorService

public static ScheduledExecutorService protectedScheduledExecutorService(ScheduledExecutorService target)
Wrap a scheduled executor with a ScheduledExecutorService instance which supports all the features of ScheduledExecutorService except for shutting down the executor.

Parameters:
target - the target executor
Returns:
the executor service

protectedBlockingExecutorService

public static BlockingExecutorService protectedBlockingExecutorService(BlockingExecutor target)
Wrap a blocking executor with an BlockingExecutorService instance which supports all the features of BlockingExecutorService except for shutting down the executor.

Parameters:
target - the target executor
Returns:
the executor service

resettingThreadFactory

public static ThreadFactory resettingThreadFactory(ThreadFactory delegate)
                                            throws SecurityException
Create a thread factory which resets all thread-local storage and delegates to the given thread factory. You must have the RuntimePermission("modifyThread") permission to use this method.

Parameters:
delegate - the delegate thread factory
Returns:
the resetting thread factory
Throws:
SecurityException - if the caller does not have the RuntimePermission("modifyThread") permission

wrappingThreadFactory

public static ThreadFactory wrappingThreadFactory(DirectExecutor taskWrapper,
                                                  ThreadFactory delegate)
Creates a thread factory which executes the thread task via the given task wrapping executor.

Parameters:
taskWrapper - the task wrapping executor
delegate - the delegate thread factory
Returns:
the wrapping thread factory

nullRunnable

public static Runnable nullRunnable()
Get the null runnable which does nothing.

Returns:
the null runnable

threadLocalResetter

public static Runnable threadLocalResetter()
                                    throws SecurityException
Get a Runnable which, when executed, clears the thread-local storage of the calling thread. You must have the RuntimePermission("modifyThread") permission to use this method.

Returns:
the runnable
Throws:
SecurityException - if the caller does not have the RuntimePermission("modifyThread") permission

contextClassLoaderResetter

public static Runnable contextClassLoaderResetter()
Get a Runnable which, when executed, clears the thread context class loader (if the caller has sufficient privileges).

Returns:
the runnable

executorTask

public static Runnable executorTask(DirectExecutor executor,
                                    Runnable task)
Get a task that runs the given task through the given direct executor.

Parameters:
executor - the executor to run the task through
task - the task to run
Returns:
an encapsulating task

compositeTask

public static Runnable compositeTask(Runnable... runnables)
Create a task that is a composite of several other tasks.

Parameters:
runnables - the tasks
Returns:
the composite task

classLoaderPreservingTask

public static Runnable classLoaderPreservingTask(Runnable delegate)
                                          throws SecurityException
Create a task that delegates to the given task, preserving the context classloader which was in effect when this method was invoked.

Parameters:
delegate - the delegate runnable
Returns:
the wrapping runnable
Throws:
SecurityException - if a security manager exists and the caller does not have the "copyClassLoader" RuntimePermission.

compositeTask

public static Runnable compositeTask(Collection<Runnable> runnables)
Create a task that is a composite of several other tasks.

Parameters:
runnables - the tasks
Returns:
the composite task

loggingExceptionHandler

public static Thread.UncaughtExceptionHandler loggingExceptionHandler(org.jboss.logging.Logger log)
Get an uncaught exception handler which logs to the given logger.

Parameters:
log - the logger
Returns:
the handler

loggingExceptionHandler

public static Thread.UncaughtExceptionHandler loggingExceptionHandler(String categoryName)
Get an uncaught exception handler which logs to the given logger.

Parameters:
categoryName - the name of the logger category to log to
Returns:
the handler

loggingExceptionHandler

public static Thread.UncaughtExceptionHandler loggingExceptionHandler()
Get an uncaught exception handler which logs to the default error logger.

Returns:
the handler

run

public static <R extends Runnable,A> void run(R task,
                                              DirectExecutor directExecutor,
                                              TaskNotifier<? super R,? super A> notifier,
                                              A attachment)
Run a task through the given direct executor, invoking the given notifier with the given attachment.

Type Parameters:
R - the task type
A - the attachment type
Parameters:
task - the task
directExecutor - the executor
notifier - the notifier
attachment - the attachment

run

public static <R extends Runnable,A> void run(R task,
                                              TaskNotifier<? super R,? super A> notifier,
                                              A attachment)
Run a task, invoking the given notifier with the given attachment.

Type Parameters:
R - the task type
A - the attachment type
Parameters:
task - the task
notifier - the notifier
attachment - the attachment

notifyingRunnable

public static <R extends Runnable,A> Runnable notifyingRunnable(R task,
                                                                TaskNotifier<? super R,? super A> notifier,
                                                                A attachment)
Get a notifying runnable wrapper for a task. The notifier will be invoked when the task is run.

Type Parameters:
R - the task type
A - the attachment type
Parameters:
task - the task
notifier - the notifier
attachment - the attachment
Returns:
the wrapping runnable

notifyingDirectExecutor

public static <A> DirectExecutor notifyingDirectExecutor(DirectExecutor delegate,
                                                         TaskNotifier<Runnable,? super A> notifier,
                                                         A attachment)
Get a notifying direct executor. The notifier will be invoked when each task is run.

Type Parameters:
A - the attachment type
Parameters:
delegate - the executor which will actually run the task
notifier - the notifier
attachment - the attachment
Returns:
the direct executor

executeUninterruptibly

public static void executeUninterruptibly(Executor executor,
                                          Runnable task)
                                   throws RejectedExecutionException
Execute a task uninterruptibly.

Parameters:
executor - the executor to delegate to
task - the task to execute
Throws:
RejectedExecutionException - if the task was rejected by the executor

uninterruptibleExecutor

public static Executor uninterruptibleExecutor(Executor delegate)
Get an executor which executes tasks uninterruptibly in the event of blocking.

Parameters:
delegate - the delegate executor
Returns:
the uninterruptible executor

dependencyTaskBuilder

public static DependencyTaskBuilder dependencyTaskBuilder(Executor executor,
                                                          Runnable task)
Create a builder for a dependent task.

Parameters:
executor - the executor to use
task - the task to run when all dependencies are met
Returns:
the builder

JBoss Threads 2.0.0.GA

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.