Class FunctionalWaitModelingEngine

java.lang.Object
gov.nasa.jpl.engine.ModelingEngine
gov.nasa.jpl.engine.FunctionalWaitModelingEngine
All Implemented Interfaces:
WaitProvider

public class FunctionalWaitModelingEngine extends ModelingEngine implements WaitProvider
Implementation of ModelingEngine that uses ArrayBlockingQueue objects for synchronization between threads. Schedules Waiter objects to run at a given time. Waiter objects basically contain information to run a function at a given time. These are used to schedule Activity modeling, resuming threads, or Activity functions which need to be run upon a signal or time.
  • Method Details

    • runModeling

      protected void runModeling()
      Method which runs the modeling. All Activity objects are scheduled to run.
      Specified by:
      runModeling in class ModelingEngine
    • insertActivityIntoEngine

      public void insertActivityIntoEngine(Activity activity)
      Inserts an Activity into the modeling queue.
      Specified by:
      insertActivityIntoEngine in class ModelingEngine
      Parameters:
      activity - the activity to be inserted.
    • waitUntil

      public void waitUntil(Time t)
      Schedules a Waiter to resume this thread at time t.
      Specified by:
      waitUntil in interface WaitProvider
      Parameters:
      t - the time to resume execution.
    • waitForSignal

      public Map waitForSignal(String signalName) throws InterruptedException
      Schedules a waiter to resume this thread upon the given signal
      Specified by:
      waitForSignal in interface WaitProvider
      Parameters:
      signalName - name of signal to wait
      Returns:
      data sent when the signal was raised
      Throws:
      InterruptedException
    • waitUntil

      public Waiter waitUntil(Time t, Supplier<Waiter> func)
      Returns a Waiter object that can be returned to the modeling engine to execute at a time in the future.
      Specified by:
      waitUntil in interface WaitProvider
      Parameters:
      t - time in future to execute the given function
      func - the given function
      Returns:
      Waiter object
    • waitForSignal

      public Waiter waitForSignal(String signalName, Function<Map,Waiter> func)
      Specified by:
      waitForSignal in interface WaitProvider