Class MinIntervalExecutor

java.lang.Object
com.webfirmframework.wffweb.concurrent.MinIntervalExecutor

public final class MinIntervalExecutor extends Object
It makes sure that the task is invoked only once in the specified interval of time even if the runAsync() methods is called by multiple threads less than the interval of specified time.
Since:
3.0.16
  • Constructor Details

    • MinIntervalExecutor

      public MinIntervalExecutor(Executor executor, long minInterval, Runnable task)
      Parameters:
      executor - the executor object to use thread from it.
      minInterval - in milliseconds. It keeps the minimum interval between the task execution.
      task - the Runnable object to execute.
    • MinIntervalExecutor

      public MinIntervalExecutor(long minInterval, Runnable task)
      Parameters:
      minInterval - in milliseconds. It keeps the minimum interval between the task execution.
      task - the Runnable object to execute.
  • Method Details

    • runAsync

      public void runAsync()
      Runs the task given in the constructor in an asynchronous mode.
      Since:
      3.0.16
    • minInterval

      public long minInterval()
      Returns:
      the minInterval
      Since:
      3.0.16