Class ExecutionEnvironment

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

public class ExecutionEnvironment extends 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:
  • Field Details

    • taskProvider

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

      protected final ExecutorService executor
    • tasks

      protected final List<Task> tasks
    • listeners

      protected final Set<TaskListener> listeners
  • Constructor Details

    • ExecutionEnvironment

      @Inject public ExecutionEnvironment(com.google.inject.Provider<Task> taskProvider)
      Constructs a ExecutionEnvironment.
      Parameters:
      taskProvider - the task provider
  • Method Details

    • execute

      public void execute(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:
    • getTasks

      public 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