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 TypeMethodDescriptionvoid
insertActivityIntoEngine
(Activity activity) Inserts an Activity into the modeling queue.protected void
Method which runs the modeling.waitForSignal
(String signalName) Schedules a waiter to resume this thread upon the given signalwaitForSignal
(String signalName, Function<Map, Waiter> func) void
Schedules 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, setTime
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
runModeling
in classModelingEngine
-
insertActivityIntoEngine
Inserts an Activity into the modeling queue.- Specified by:
insertActivityIntoEngine
in classModelingEngine
- Parameters:
activity
- the activity to be inserted.
-
waitUntil
Schedules a Waiter to resume this thread at time t.- Specified by:
waitUntil
in interfaceWaitProvider
- Parameters:
t
- the time to resume execution.
-
waitForSignal
Schedules a waiter to resume this thread upon the given signal- Specified by:
waitForSignal
in 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:
waitUntil
in interfaceWaitProvider
- Parameters:
t
- time in future to execute the given functionfunc
- the given function- Returns:
- Waiter object
-
waitForSignal
- Specified by:
waitForSignal
in interfaceWaitProvider
-