public final class BusySpinIdleStrategy extends Object implements IdleStrategy
Constructor and Description |
---|
BusySpinIdleStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
idle()
Perform current idle action (e.g.
|
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 void idle(int workCount)
Callers are expected to follow this pattern:
while (isRunning)
{
idleStrategy.idle(doWork());
}
idle
in interface IdleStrategy
workCount
- 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 IdleStrategy
public void reset()
reset
in interface IdleStrategy
Copyright © 2014-2019 Real Logic Ltd. All Rights Reserved.