Class DefaultExecutionContext

    • Constructor Detail

      • DefaultExecutionContext

        public DefaultExecutionContext​(long time)
        Create a DefaultExecutionContext
        Parameters:
        time - initial clock time / start time
    • Method Detail

      • addClockListener

        public void addClockListener​(ExecutionContext.ClockListener listener)
        Description copied from interface: ExecutionContext
        Add a listener for clock changes. Listeners will be called every time the Root is active and its local time changes - the frequency of changes, and whether the frequency is fixed or variable, is Root implementation specific.
        Specified by:
        addClockListener in interface ExecutionContext
        Parameters:
        listener - clock listener, may not be null
      • updateState

        protected void updateState​(long time,
                                   ExecutionContext.State state)
        Update the state. Will call all state listeners.
        Parameters:
        time - time of state change (if ACTIVE also the new start time)
        state - new state
        Throws:
        IllegalStateException - if attempting to reset to NEW from another state, or attempting to set to another state if current state is TERMINATED
      • updateClock

        protected void updateClock​(long time)
        Update the clock time. Will call all clock listeners.
        Parameters:
        time -
      • getTime

        public long getTime()
        Description copied from interface: ExecutionContext
        Get the current Root local time in nanoseconds, relative to the RootHub clock.
        Specified by:
        getTime in interface ExecutionContext
        Returns:
        time in nanoseconds
      • getStartTime

        public long getStartTime()
        Description copied from interface: ExecutionContext
        Get the clock time in nanoseconds when the Root last became active. If the current state is not active, the return value is not valid.
        Specified by:
        getStartTime in interface ExecutionContext
        Returns:
        clock time became active