Package org.aksw.commons.util.concurrent
Class ScheduleOnce2
- java.lang.Object
-
- org.aksw.commons.util.concurrent.ScheduleOnce2
-
public class ScheduleOnce2 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 Summary
Fields Modifier and Type Field Description protected java.util.function.Consumer<Callable<?>>executorprotected longlastRequestTimeprotected LonglastTaskStartTimeprotected Objectlockprotected Callable<?>task
-
Constructor Summary
Constructors Constructor Description ScheduleOnce2(java.util.function.Consumer<Callable<?>> executor, Callable<?> task)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidscheduleTask()
-