public class CoalescingDelayedTrigger extends Object
Runnable
.
Once you call the executeWithDelay()
it will wait specified amount of time before actually executing
the Runnable. If executeWithDelay()
is invoked again within the interval then the Runnable will
be executed only once.
It also guarantees no execution will be delayed more than specified maximum delay.
This class is not thread-safe and external synchronization must be ensured when multiple
threads are calling executeWithDelay()
Constructor and Description |
---|
CoalescingDelayedTrigger(ExecutionService executionService,
long delay,
long maxDelay,
Runnable runnable) |
Modifier and Type | Method and Description |
---|---|
void |
executeWithDelay()
invoke delayed execution.
|
public CoalescingDelayedTrigger(ExecutionService executionService, long delay, long maxDelay, Runnable runnable)
executionService
- delay
- execution delay in msmaxDelay
- maximum delay in ms. No action will be delayed more specified number of ms.runnable
- action to be executedCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.