Class Scheduler

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class Scheduler
    extends Object
    implements Closeable
    A simple scheduler for executing and scheduling tasks in the background. This implementation delegates all background execution to an instance of a ScheduledExecutorService with core pool size 1. The behaviour of this underlying scheduler service determines the semantics of the methods in this class. Namely: Execution of background tasks never overlaps and is FIFO for tasks scheduled for the same time. In addition all tasks scheduled through methods of this class are automatically wrapped into SafeRunnable instances. The background thread executing submitted tasks is a deamon thread.