public class ExecutionEnvironment extends java.lang.Object implements TaskStateListener
ExecutionEnvironment
for Task
s. The environment starts
and monitors optimization tasks. Tasks are not submitted directly, instead a
collection of Module
s is submitted and a Task
is created. The
ExecutionEnvironment
is processing the Task
s 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
Task s. |
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 Task
protected 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()
Task
s.public void stateChanged(Task task)
TaskStateListener
Task
changes its state.stateChanged
in interface TaskStateListener
task
- the task that changed its state