org.opt4j.core.config
Class ExecutionEnvironment

java.lang.Object
  extended by org.opt4j.core.config.ExecutionEnvironment
All Implemented Interfaces:
TaskStateListener

public class ExecutionEnvironment
extends java.lang.Object
implements 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:
Task

Field Summary
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 Summary
ExecutionEnvironment(com.google.inject.Provider<Task> taskProvider)
          Constructs a ExecutionEnvironment.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taskProvider

protected final com.google.inject.Provider<Task> taskProvider

executor

protected final java.util.concurrent.ExecutorService executor

tasks

protected final java.util.List<Task> tasks

listeners

protected final java.util.Set<TaskListener> listeners
Constructor Detail

ExecutionEnvironment

@Inject
public ExecutionEnvironment(com.google.inject.Provider<Task> taskProvider)
Constructs a ExecutionEnvironment.

Parameters:
taskProvider - the task provider
Method Detail

execute

public void execute(java.util.Collection<com.google.inject.Module> modules)
Executes the specified modules: A Task is created and submitted.

Parameters:
modules - the collection of modules for a Task

addTask

protected void addTask(Task task)
Adds a Task and calls the listeners.

Parameters:
task - the task to add

addListener

public void addListener(TaskListener listener)
Adds a TaskListener.

Parameters:
listener - the listener to be added

removeListener

public void removeListener(TaskListener listener)
Removes a TaskListener.

Parameters:
listener - the listener to be removed
See Also:
addListener(org.opt4j.core.config.TaskListener)

getTasks

public java.util.List<Task> getTasks()
Returns the list of all Tasks.

Returns:
the list of all tasks

stateChanged

public void stateChanged(Task task)
Description copied from interface: TaskStateListener
Invoked if a Task changes its state.

Specified by:
stateChanged in interface TaskStateListener
Parameters:
task - the task that changed its state