Class SlotStateTracker


  • public class SlotStateTracker
    extends java.lang.Object
    Holds 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
      void enterState​(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.
      RunState getSlotState()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SlotStateTracker

        public SlotStateTracker​(long slotId)
    • 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