Class ScheduleOnce

java.lang.Object
org.aksw.commons.util.concurrent.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 Details

    • scheduledExecutorService

      protected ScheduledExecutorService scheduledExecutorService
    • execDelay

      protected Duration execDelay
    • task

      protected Callable<?> task
    • lastRequestTime

      protected volatile Instant lastRequestTime
    • lastExecTime

      protected volatile Instant lastExecTime
    • lock

      protected final Object lock
  • Constructor Details

  • Method Details

    • scheduleOneTaskAtATime

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

      public void scheduleTask()