A Scheduler is RxJava's abstraction for pooling threads and scheduling tasks to be executed by them. These tasks may be executed immediately, delayed, or repeated periodically depending on which of its execution methods are called. These execution methods are scheduleDirect() and schedulePeriodicallyDirect(), which have a few overloads. For example, we can use the Scheduler computation to execute an immediate task, a delayed task, and a repeated task, as shown here:
import io.reactivex.rxjava3.core.Scheduler;
import io.reactivex.rxjava3.schedulers.Schedulers;
import java.util.concurrent.TimeUnit;
public class E_01 {
public static void main(String[] args) {
Scheduler scheduler = Schedulers.computation();
//run task now
scheduler.scheduleDirect(() -> System.out.println("Now!"));
//delay task by 1 second
...