Class ScheduleOnce


  • public class ScheduleOnce
    extends Object
    Class to schedule a task after a certain delay and ensure that it only executes once. If there is a request to schedule the task while it is already running it will be scheduled for the delay.
    Author:
    raven
    • Field Detail

      • execDelay

        protected java.time.Duration execDelay
      • lastRequestTime

        protected volatile java.time.Instant lastRequestTime
      • lastExecTime

        protected volatile java.time.Instant lastExecTime
      • lock

        protected final Object lock
    • Method Detail

      • scheduleOneTaskAtATime

        public static ScheduleOnce scheduleOneTaskAtATime​(java.time.Duration execDelay,
                                                          Callable<?> task)
      • scheduleTask

        public void scheduleTask()