Package io.engineblock.activityimpl
Class SlotStateTracker
- java.lang.Object
-
- io.engineblock.activityimpl.SlotStateTracker
-
public class SlotStateTracker extends java.lang.ObjectHolds the state of a slot, allows only valid transitions, and shares the slot state as
-
-
Constructor Summary
Constructors Constructor Description SlotStateTracker(long slotId)
-
Method Summary
Modifier and Type Method Description voidenterState(RunState to)Transition the thread slot to a new state.java.util.concurrent.atomic.AtomicReference<RunState>getAtomicSlotState()This is how you share the current slot state most directly, but it has a caveat.RunStategetSlotState()
-
-
-
Method Detail
-
getSlotState
public RunState getSlotState()
-
getAtomicSlotState
public java.util.concurrent.atomic.AtomicReference<RunState> getAtomicSlotState()
This is how you share the current slot state most directly, but it has a caveat. By sharing the slot state in this way, you allow external changes. You should only use this method to share slot state for observers.- Returns:
- an atomic reference for SlotState
-
enterState
public void enterState(RunState to)
Transition the thread slot to a new state. only accepting valid transitions.
The valid slot states will be moved to a data type eventually, simplifying this method.
- Parameters:
to- The next SlotState for this thread/slot/motor
-
-