Interface Scheduler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A source of delays useful for scheduling message delivery in tests.
-
Method Summary
Modifier and TypeMethodDescriptionstatic SchedulerReturns a scheduler that delays messages by a random amount between 80ms and 120ms.static SchedulerdefaultScheduler(Random rand) Returns a scheduler that delays messages by a random amount between 80ms and 120ms using the given random number generator.static SchedulerrandomScheduler(Random rand, long base, long jitter) Returns a scheduler that delays messages by a random amount betweenbaseandbase + jitterat millisecond precision using the given random number generator.schedule()Returns the delay until the value should be scheduled.
-
Method Details
-
defaultScheduler
Returns a scheduler that delays messages by a random amount between 80ms and 120ms.- Returns:
- the scheduler
-
defaultScheduler
-
randomScheduler
-
schedule
Duration schedule()Returns the delay until the value should be scheduled. Must not be negative.- Returns:
- the non-negative delay until the value should be scheduled
-