public final class SchedulingContexts extends Object
Modifier and Type | Method and Description |
---|---|
static SchedulingContext |
alwaysPause()
Returns a scheduling context that always returns
true from
SchedulingContext.shouldPause() , i.e., that always indicates
that the caller should yield. |
static SchedulingContextFactory |
alwaysPauseFactory()
Returns a scheduling context factory that always returns
alwaysPause() . |
static SchedulingContextFactory |
countDownContextFactory(long max)
Returns a scheduling context factory that always returns
newCountDownContext(long)
with the argument max . |
static SchedulingContext |
neverPause()
Returns a scheduling context that always returns
false from
SchedulingContext.shouldPause() , i.e., that never indicates
that the caller should yield. |
static SchedulingContextFactory |
neverPauseFactory()
Returns a scheduling context factory that always returns
neverPause() . |
static SchedulingContext |
newCountDownContext(long max)
Returns a scheduling context with an internal tick counter (initialised to
max ). |
public static SchedulingContext neverPause()
false
from
SchedulingContext.shouldPause()
, i.e., that never indicates
that the caller should yield.public static SchedulingContext alwaysPause()
true
from
SchedulingContext.shouldPause()
, i.e., that always indicates
that the caller should yield.public static SchedulingContext newCountDownContext(long max)
max
).
Every call to SchedulingContext.registerTicks(int)
with a positive argument
decreases the counter accordingly (calls with non-positive arguments are ignored).
The scheduling context returns true
from SchedulingContext.shouldPause()
if and only if counter is lesser than or equal to 0.
max
- the initial counter value, must be non-negativeIllegalArgumentException
- when max
is negativepublic static SchedulingContextFactory neverPauseFactory()
neverPause()
.public static SchedulingContextFactory alwaysPauseFactory()
alwaysPause()
.public static SchedulingContextFactory countDownContextFactory(long max)
newCountDownContext(long)
with the argument max
.max
- the initial counter value, must be non-negativeIllegalArgumentException
- when max
is negativeCopyright © 2016. All rights reserved.