public final class NoOpIdleStrategy extends Object implements IdleStrategy
| Modifier and Type | Field and Description |
|---|---|
static String |
ALIAS
Name to be returned from
alias(). |
static NoOpIdleStrategy |
INSTANCE
As there is no instance state then this object can be used to save on allocation.
|
| Constructor and Description |
|---|
NoOpIdleStrategy() |
| Modifier and Type | Method and Description |
|---|---|
String |
alias()
Simple name by which the strategy can be identified.
|
void |
idle()
Note: this implementation will result in no safepoint poll once inlined.
|
void |
idle(int workCount)
Note: this implementation will result in no safepoint poll once inlined.
|
void |
reset()
Reset the internal state in preparation for entering an idle state again.
|
String |
toString() |
public static final String ALIAS
alias().public static final NoOpIdleStrategy INSTANCE
public void idle(int workCount)
Callers are expected to follow this pattern:
while (isRunning)
{
idleStrategy.idle(doWork());
}
idle in interface IdleStrategyworkCount - performed in last duty cycle.public void idle()
IdleStrategy.reset() to clear internal state when idle period is over (or before it begins).
Callers are expected to follow this pattern:
while (isRunning)
{
if (!hasWork())
{
idleStrategy.reset();
while (!hasWork())
{
if (!isRunning)
{
return;
}
idleStrategy.idle();
}
}
doWork();
}
idle in interface IdleStrategypublic void reset()
reset in interface IdleStrategypublic String alias()
alias in interface IdleStrategyCopyright © 2014-2020 Real Logic Limited. All Rights Reserved.