public interface ExecutionManager
Runnable
s, Callable
s, or Closure
s
Task
instances (see below)
The advantage of treating them as Task
instances include:
For usage instructions see submit(Map, TaskAdaptable)
, and for examples see the various
ExecutionTest
and TaskTest
instances.
It has been developed for multi-location provisioning and management to track work being
done by each Entity
.
Note the use of the environment variable THREAD_POOL_SIZE
which is used to size
the ExecutorService
thread pool. The default is calculated as twice the number
of CPUs in the system plus two, giving 10 for a four core system, 18 for an eight CPU
server and so on.
Modifier and Type | Method and Description |
---|---|
Task<?> |
getTask(java.lang.String id)
returns the task with the given ID, or null if none
|
java.util.Set<Task<?>> |
getTasksWithAllTags(java.lang.Iterable<?> tags)
returns all tasks that have all of the given tags (immutable)
|
java.util.Set<Task<?>> |
getTasksWithAnyTag(java.lang.Iterable<?> tags)
returns all tasks that have any of the given tags (immutable)
|
java.util.Set<Task<?>> |
getTasksWithTag(java.lang.Object tag)
returns all tasks with the given tag (immutable)
|
java.util.Set<java.lang.Object> |
getTaskTags()
returns all tags known to this manager (immutable)
|
boolean |
isShutdown() |
<T> Task<T> |
submit(java.util.concurrent.Callable<T> c)
|
<T> Task<T> |
submit(java.util.Map<?,?> flags,
java.util.concurrent.Callable<T> c)
|
Task<?> |
submit(java.util.Map<?,?> flags,
java.lang.Runnable r)
|
<T> Task<T> |
submit(java.util.Map<?,?> flags,
TaskAdaptable<T> task)
Submits the given
Task for execution in the context associated with this manager. |
Task<?> |
submit(java.lang.Runnable r)
|
<T> Task<T> |
submit(TaskAdaptable<T> task)
|
boolean isShutdown()
Task<?> getTask(java.lang.String id)
java.util.Set<Task<?>> getTasksWithTag(java.lang.Object tag)
java.util.Set<Task<?>> getTasksWithAnyTag(java.lang.Iterable<?> tags)
java.util.Set<Task<?>> getTasksWithAllTags(java.lang.Iterable<?> tags)
java.util.Set<java.lang.Object> getTaskTags()
Task<?> submit(java.lang.Runnable r)
<T> Task<T> submit(java.util.concurrent.Callable<T> c)
<T> Task<T> submit(TaskAdaptable<T> task)
Task<?> submit(java.util.Map<?,?> flags, java.lang.Runnable r)
<T> Task<T> submit(java.util.Map<?,?> flags, java.util.concurrent.Callable<T> c)
<T> Task<T> submit(java.util.Map<?,?> flags, TaskAdaptable<T> task)
Task
for execution in the context associated with this manager.
The following optional flags supported (in the optional map first arg):
Collection
of object tags each of which the task should be associated,
used for associating with contexts, mutex execution, and other purposes
Collection
of strings, representing a category on which an object should own a synch lock
Collection
of strings, representing a category on which an object should own a synch lock
Closure
that will be invoked just before the task starts if it starts as a result of this call
Closure
that will be invoked when the task completes if it starts as a result of this call
Closure
it is passed the task for convenience. The closure can be any of the
following types; either a Closure
, Runnable
or Callable
.
If a Map is supplied it must be modifiable (currently; may allow immutable maps in future).