All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.transferwise.common.baseutils.concurrency.ScheduledTaskExecutor Maven / Gradle / Ivy

package com.transferwise.common.baseutils.concurrency;

import java.time.Duration;

public interface ScheduledTaskExecutor {

  TaskHandle scheduleAtFixedInterval(Runnable task, Duration initialDelay, Duration period);

  TaskHandle scheduleOnce(Runnable task, Duration initialDelay);

  void start();

  void stop();

  boolean hasStopped();

  boolean waitUntilStopped(Duration waitTime);

  interface TaskHandle {

    void stop();

    boolean hasStopped();

    @SuppressWarnings("UnusedReturnValue")
    boolean waitUntilStopped(Duration waitTime);

    boolean isWorking();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy