public interface

ScheduleExecutor

uk.ac.imperial.presage2.core.simulator.ScheduleExecutor
Known Indirect Subclasses

Class Overview

Wrapper for an ExecutorService. Allows for the controller to wait for completion of tasks according to specified conditions.

Summary

Nested Classes
enum ScheduleExecutor.WaitCondition Conditions specifying a simulation schedule over a timestep. 
Public Methods
abstract int getThreadCount()
Get number of threads in use by this executor.
abstract void shutdown()
Shutdown executor.
abstract void submit(Runnable s)
Submit a task with no completion condition to wait for.
abstract void submitScheduled(Runnable s, ScheduleExecutor.WaitCondition condition)
Submit a task with specified ScheduleExecutor.WaitCondition.
abstract Future<Boolean> submitScheduledConditional(Callable<Boolean> s, ScheduleExecutor.WaitCondition condition)
Submit a conditional task and receive a Future representing its future return value.
abstract void waitFor(ScheduleExecutor.WaitCondition condition)
Wait for all scheduled tasks for the specified ScheduleExecutor.WaitCondition to complete.

Public Methods

public abstract int getThreadCount ()

Get number of threads in use by this executor.

public abstract void shutdown ()

Shutdown executor.

public abstract void submit (Runnable s)

Submit a task with no completion condition to wait for.

public abstract void submitScheduled (Runnable s, ScheduleExecutor.WaitCondition condition)

Submit a task with specified ScheduleExecutor.WaitCondition.

Parameters
s Runnable task

public abstract Future<Boolean> submitScheduledConditional (Callable<Boolean> s, ScheduleExecutor.WaitCondition condition)

Submit a conditional task and receive a Future representing its future return value.

Parameters
s Callable task, returning a boolean.
Returns
  • Future for this task.

public abstract void waitFor (ScheduleExecutor.WaitCondition condition)

Wait for all scheduled tasks for the specified ScheduleExecutor.WaitCondition to complete.