Package org.opt4j.config
Class ExecutionEnvironment
java.lang.Object
org.opt4j.config.ExecutionEnvironment
- All Implemented Interfaces:
TaskStateListener
The
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ExecutorServiceprotected final Set<TaskListener>protected final com.google.inject.Provider<Task> -
Constructor Summary
ConstructorsConstructorDescriptionExecutionEnvironment(com.google.inject.Provider<Task> taskProvider) Constructs aExecutionEnvironment. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(TaskListener listener) Adds aTaskListener.protected voidAdds aTaskand calls the listeners.voidexecute(Collection<com.google.inject.Module> modules) Executes the specified modules: ATaskis created and submitted.getTasks()Returns the list of allTasks.voidremoveListener(TaskListener listener) Removes aTaskListener.voidstateChanged(Task task) Invoked if aTaskchanges its state.
-
Field Details
-
taskProvider
-
executor
-
tasks
-
listeners
-
-
Constructor Details
-
ExecutionEnvironment
Constructs aExecutionEnvironment.- Parameters:
taskProvider- the task provider
-
-
Method Details
-
execute
Executes the specified modules: ATaskis created and submitted.- Parameters:
modules- the collection of modules for aTask
-
addTask
Adds aTaskand calls the listeners.- Parameters:
task- the task to add
-
addListener
Adds aTaskListener.- Parameters:
listener- the listener to be added
-
removeListener
Removes aTaskListener.- Parameters:
listener- the listener to be removed- See Also:
-
getTasks
Returns the list of allTasks.- Returns:
- the list of all tasks
-
stateChanged
Description copied from interface:TaskStateListenerInvoked if aTaskchanges its state.- Specified by:
stateChangedin interfaceTaskStateListener- Parameters:
task- the task that changed its state
-