|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ExecutionManager
This class manages the execution of a number of jobs with tags. It is like an executor service (and it ends up delegating to one) but adds additional support where jobs can be:
Runnables, Callables, or groovy.lang.Closures
Task instances (see below)
The advantage of treating them as Task instances include:
For usage instructions see #submit(Map, Task), 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.
| Method Summary | ||
|---|---|---|
Task<?> |
getTask(String id)
returns the task with the given ID, or null if none |
|
Set<Task<?>> |
getTasksWithAllTags(Iterable<?> tags)
returns all tasks that have all of the given tags (immutable) |
|
Set<Task<?>> |
getTasksWithAnyTag(Iterable<?> tags)
returns all tasks that have any of the given tags (immutable) |
|
Set<Task<?>> |
getTasksWithTag(Object tag)
returns all tasks with the given tag (immutable) |
|
Set<Object> |
getTaskTags()
returns all tags known to this manager (immutable) |
|
boolean |
isShutdown()
|
|
|
submit(Callable<T> c)
see #submit(Map, Task) |
|
|
submit(Map<?,?> flags,
Callable<T> c)
see #submit(Map, Task) |
|
|
submit(Map<?,?> flags,
Object c)
Deprecated. since 0.5.0 or 0.6.0, while refactoring groovy->java; use strongly typed methods |
|
Task<?> |
submit(Map<?,?> flags,
Runnable r)
see #submit(Map, Task) |
|
|
submit(Map<?,?> flags,
TaskAdaptable<T> task)
Submits the given Task for execution in the context associated with this manager. |
|
Task<?> |
submit(Runnable r)
see #submit(Map, Task) |
|
|
submit(TaskAdaptable<T> task)
see #submit(Map, Task) |
|
| Method Detail |
|---|
boolean isShutdown()
Task<?> getTask(String id)
Set<Task<?>> getTasksWithTag(Object tag)
Set<Task<?>> getTasksWithAnyTag(Iterable<?> tags)
Set<Task<?>> getTasksWithAllTags(Iterable<?> tags)
Set<Object> getTaskTags()
Task<?> submit(Runnable r)
#submit(Map, Task)
<T> Task<T> submit(Callable<T> c)
#submit(Map, Task)
<T> Task<T> submit(TaskAdaptable<T> task)
#submit(Map, Task)
Task<?> submit(Map<?,?> flags,
Runnable r)
#submit(Map, Task)
<T> Task<T> submit(Map<?,?> flags,
Callable<T> c)
#submit(Map, Task)
@Deprecated
<T> Task<T> submit(Map<?,?> flags,
Object c)
#submit(Map, Task)}
<T> Task<T> submit(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
groovy.lang.Closure that will be invoked just before the task starts if it starts as a result of this call
groovy.lang.Closure that will be invoked when the task completes if it starts as a result of this call
groovy.lang.Closure it is passed the task for convenience. The closure can be any of the
following types; either a groovy.lang.Closure, Runnable or Callable.
If a Map is supplied it must be modifiable (currently; may allow immutable maps in future).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||