Module aeonics.core

Class Timeout

  • All Implemented Interfaces:
    Exportable, Snapshotable

    public abstract class Timeout
    extends Manager.Type
    This manager is keeping track of elements that expire or should be triggered after a specified amount of time. An element can only be triggered once and then it is removed from the watch list. In behavior, this is similar to Scheduler.in(java.util.function.Consumer, long) but the intent is not the same.
    • Constructor Detail

      • Timeout

        public Timeout()
    • Method Detail

      • manager

        public final java.lang.Class<? extends Manager.Type> manager()
        Hardcoded manager type
        Specified by:
        manager in class Manager.Type
        Returns:
        the type of manager
      • watch

        public abstract <T> void watch​(Timeout.Tracker<T> tracker)
        Adds the specified tracker to the watch list.
        Type Parameters:
        T - the tracked element type
        Parameters:
        tracker - the tracker
      • remove

        public abstract <T> void remove​(Timeout.Tracker<T> tracker)
        Removes the specified tracker from the watch list.
        Type Parameters:
        T - the tracked element type
        Parameters:
        tracker - the tracker
      • refresh

        public abstract void refresh()
        This method will re-inspect all Timeout.Tracker in the watch list to determine if some elements have expired. You should not need to call this method unless in some specific circumstances.