Package gov.nasa.jpl.engine
Class FunctionalWaitModelingEngine
java.lang.Object
gov.nasa.jpl.engine.ModelingEngine
gov.nasa.jpl.engine.FunctionalWaitModelingEngine
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionvoidinsertActivityIntoEngine(Activity activity) Inserts an Activity into the modeling queue.protected voidMethod which runs the modeling.waitForSignal(String signalName) Schedules a waiter to resume this thread upon the given signalwaitForSignal(String signalName, Function<Map, Waiter> func) voidSchedules a Waiter to resume this thread at time t.Returns a Waiter object that can be returned to the modeling engine to execute at a time in the future.Methods inherited from class gov.nasa.jpl.engine.ModelingEngine
getCurrentTime, getEngine, initTime, isCurrentlyReadingInFile, isModeling, model, resetEngine, setCurrentlyReadingInFile, setEngine, setTimeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nasa.jpl.activity.WaitProvider
getCurrentTime
-
Method Details
-
runModeling
protected void runModeling()Method which runs the modeling. All Activity objects are scheduled to run.- Specified by:
runModelingin classModelingEngine
-
insertActivityIntoEngine
Inserts an Activity into the modeling queue.- Specified by:
insertActivityIntoEnginein classModelingEngine- Parameters:
activity- the activity to be inserted.
-
waitUntil
Schedules a Waiter to resume this thread at time t.- Specified by:
waitUntilin interfaceWaitProvider- Parameters:
t- the time to resume execution.
-
waitForSignal
Schedules a waiter to resume this thread upon the given signal- Specified by:
waitForSignalin interfaceWaitProvider- Parameters:
signalName- name of signal to wait- Returns:
- data sent when the signal was raised
- Throws:
InterruptedException
-
waitUntil
Returns a Waiter object that can be returned to the modeling engine to execute at a time in the future.- Specified by:
waitUntilin interfaceWaitProvider- Parameters:
t- time in future to execute the given functionfunc- the given function- Returns:
- Waiter object
-
waitForSignal
- Specified by:
waitForSignalin interfaceWaitProvider
-