Package dev.brachtendorf.concurrency
Class RunnableWithCallback
- java.lang.Object
-
- dev.brachtendorf.concurrency.RunnableWithCallback
-
- All Implemented Interfaces:
Runnable
public class RunnableWithCallback extends Object implements Runnable
A runnable wrapper which can be useful to schedule a task with a specific delay and invoking a callback once the runnable finished executing.e.g. conditional task rescheduling
Callback callback = { //Check if we want to reschedule a new task Runnable rescheduledTask = new Task(); Exector.schedule(new RunnableWithCallBack(rescheduledTask,this),newDelay,timeunit); }; Runnable task = new Task(); RunnableWithCallback wrapper = new RunnableWithCallback(task,callback); Executor.shedule(wrapper,initialDelay,TimeUnit.seconds);- Since:
- 1.0.0 com.github.kilianB
- Author:
- Kilian
-
-
Constructor Summary
Constructors Constructor Description RunnableWithCallback(Runnable task, Runnable callback)
-