public final class BusySpinIdleStrategy extends java.lang.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.
|
java.lang.String |
toString() |
public void idle(int workCount)
idle
in interface IdleStrategy
workCount
- performed in last duty cycle.IdleStrategy.idle(int)
public void idle()
IdleStrategy
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()
IdleStrategy
reset
in interface IdleStrategy
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014-2019 Real Logic Ltd. All Rights Reserved.