public interface ExecutionManager
Runnable
s or Callable
s, (support for Closure
is deprecated)
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> r)
Deprecated.
since 1.0.0 pass displayName or map
|
<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)
Deprecated.
since 1.0.0 pass displayName or map
|
<T> Task<T> |
submit(java.lang.String displayName,
java.util.concurrent.Callable<T> c)
|
Task<?> |
submit(java.lang.String displayName,
java.lang.Runnable c)
|
<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()
@Deprecated Task<?> submit(java.lang.Runnable r)
@Deprecated <T> Task<T> submit(java.util.concurrent.Callable<T> r)
Task<?> submit(java.lang.String displayName, java.lang.Runnable c)
<T> Task<T> submit(java.lang.String displayName, 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
Runnable
Callable
Function
that matches the generics <? super Task, ?>
Closure
is deprecated.
If a Map is supplied it must be modifiable (currently; may allow immutable maps in future).