public class ExecutionEnvironment extends java.lang.Object implements TaskStateListener
ExecutionEnvironment for Tasks. The environment starts
and monitors optimization tasks. Tasks are not submitted directly, instead a
collection of Modules is submitted and a Task is created. The
ExecutionEnvironment is processing the Tasks sequentially.Task| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.ExecutorService |
executor |
protected java.util.Set<TaskListener> |
listeners |
protected com.google.inject.Provider<Task> |
taskProvider |
protected java.util.List<Task> |
tasks |
| Constructor and Description |
|---|
ExecutionEnvironment(com.google.inject.Provider<Task> taskProvider)
Constructs a
ExecutionEnvironment. |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(TaskListener listener)
Adds a
TaskListener. |
protected void |
addTask(Task task)
Adds a
Task and calls the listeners. |
void |
execute(java.util.Collection<com.google.inject.Module> modules)
Executes the specified modules: A
Task is created and submitted. |
java.util.List<Task> |
getTasks()
Returns the list of all
Tasks. |
void |
removeListener(TaskListener listener)
Removes a
TaskListener. |
void |
stateChanged(Task task)
Invoked if a
Task changes its state. |
protected final com.google.inject.Provider<Task> taskProvider
protected final java.util.concurrent.ExecutorService executor
protected final java.util.List<Task> tasks
protected final java.util.Set<TaskListener> listeners
@Inject public ExecutionEnvironment(com.google.inject.Provider<Task> taskProvider)
ExecutionEnvironment.taskProvider - the task providerpublic void execute(java.util.Collection<com.google.inject.Module> modules)
Task is created and submitted.modules - the collection of modules for a Taskprotected void addTask(Task task)
Task and calls the listeners.task - the task to addpublic void addListener(TaskListener listener)
TaskListener.listener - the listener to be addedpublic void removeListener(TaskListener listener)
TaskListener.listener - the listener to be removedaddListener(org.opt4j.core.config.TaskListener)public java.util.List<Task> getTasks()
Tasks.public void stateChanged(Task task)
TaskStateListenerTask changes its state.stateChanged in interface TaskStateListenertask - the task that changed its state