public class ControllableIdleStrategy extends java.lang.Object implements IdleStrategy
| Modifier and Type | Field and Description |
|---|---|
static int |
BUSY_SPIN |
static int |
NOOP |
static int |
NOT_CONTROLLED |
static int |
PARK |
static int |
YIELD |
| Constructor and Description |
|---|
ControllableIdleStrategy(StatusIndicatorReader statusIndicatorReader) |
| Modifier and Type | Method and Description |
|---|---|
void |
idle()
Perform current idle action (e.g.
|
void |
idle(int workCount)
Idle based on current status indication value
|
void |
reset()
Reset the internal state in preparation for entering an idle state again.
|
java.lang.String |
toString() |
public static final int NOT_CONTROLLED
public static final int NOOP
public static final int BUSY_SPIN
public static final int YIELD
public static final int PARK
public ControllableIdleStrategy(StatusIndicatorReader statusIndicatorReader)
public void idle(int workCount)
idle in interface IdleStrategyworkCount - performed in last duty cycle.IdleStrategy.idle(int)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 java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2014-2019 Real Logic Ltd. All Rights Reserved.