Brooklyn

brooklyn.management
[Java] Interface ExecutionManager


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:

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 java.util.concurrent.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(java.lang.String id)

returns the task with the given ID, or null if none

java.util.Set getTaskTags()

returns all tags known to this manager (immutable)

java.util.Set getTasksWithAllTags(java.lang.Iterable tags)

returns all tasks that have all of the given tags (immutable)

java.util.Set getTasksWithAnyTag(java.lang.Iterable tags)

returns all tasks that have any of the given tags (immutable)

java.util.Set getTasksWithTag(java.lang.Object tag)

returns all tasks with the given tag (immutable)

boolean isShutdown()

Task submit(java.lang.Runnable r)

returns all tasks known to this manager (immutable)

Task submit(java.util.concurrent.Callable c)

see submit(Map, Task)

Task submit(Task task)

see submit(Map, Task)

Task submit(java.util.Map flags, java.lang.Runnable r)

see submit(Map, Task)

Task submit(java.util.Map flags, java.util.concurrent.Callable c)

see submit(Map, Task)

Task submit(java.util.Map flags, java.lang.Object c)

@see submit(Map, Task)

Task submit(java.util.Map flags, Task task)

Submits the given Task for execution in the context associated with this manager.

 

Method Detail

getTask

public Task getTask(java.lang.String id)
returns the task with the given ID, or null if none


getTaskTags

public java.util.Set getTaskTags()
returns all tags known to this manager (immutable)


getTasksWithAllTags

public java.util.Set getTasksWithAllTags(java.lang.Iterable tags)
returns all tasks that have all of the given tags (immutable)


getTasksWithAnyTag

public java.util.Set getTasksWithAnyTag(java.lang.Iterable tags)
returns all tasks that have any of the given tags (immutable)


getTasksWithTag

public java.util.Set getTasksWithTag(java.lang.Object tag)
returns all tasks with the given tag (immutable)


isShutdown

public boolean isShutdown()


submit

public Task submit(java.lang.Runnable r)
returns all tasks known to this manager (immutable)


submit

public Task submit(java.util.concurrent.Callable c)
see submit(Map, Task)


submit

public Task submit(Task task)
see submit(Map, Task)


submit

public Task submit(java.util.Map flags, java.lang.Runnable r)
see submit(Map, Task)


submit

public Task submit(java.util.Map flags, java.util.concurrent.Callable c)
see submit(Map, Task)


submit

@Deprecated
public Task submit(java.util.Map flags, java.lang.Object c)
deprecated:
While refactoring groovy->java; use strongly typed methods
See Also:


submit

public Task submit(java.util.Map flags, Task task)
Submits the given Task for execution in the context associated with this manager. The following optional flags supported (in the optional map first arg): Callbacks run in the task's thread, and if the callback is a groovy.lang.Closure it is passed the task for convenience. The closure can be any of the following types; either a groovy.lang.Closure, java.lang.Runnable or java.util.concurrent.Callable.

If a Map is supplied it must be modifiable (currently; may allow immutable maps in future).


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.