Class MinIntervalExecutor
java.lang.Object
com.webfirmframework.wffweb.concurrent.MinIntervalExecutor
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 Summary
ConstructorsConstructorDescriptionMinIntervalExecutor
(long minInterval, Runnable task) MinIntervalExecutor
(Executor executor, long minInterval, Runnable task) -
Method Summary
Modifier and TypeMethodDescriptionlong
void
runAsync()
Runs the task given in the constructor in an asynchronous mode.
-
Constructor Details
-
MinIntervalExecutor
-
MinIntervalExecutor
- 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
-