org.mentaqueue.wait
Class SpinYieldParkWaitStrategy
java.lang.Object
org.mentaqueue.wait.SpinYieldParkWaitStrategy
- All Implemented Interfaces:
- WaitStrategy
public class SpinYieldParkWaitStrategy
- extends Object
- implements WaitStrategy
This wait strategy first busy spinings, then yields, then sleep. You can configure each component by passing a spinCount and yieldCount.
It optionally supports backing-off for the LockSupport.parkNanos method, increasing the sleep time by one nanosecond until the reset
method is called.
- Author:
- Sergio Oliveira Jr.
|
Method Summary |
void |
reset()
Reset the strategy because we have waited and we have accomplished what we were waiting for. |
void |
waitForOtherThread()
Do something to wait: busy spinning, yield or sleep. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpinYieldParkWaitStrategy
public SpinYieldParkWaitStrategy(int spinCount,
int yieldCount,
boolean parkBackOff)
SpinYieldParkWaitStrategy
public SpinYieldParkWaitStrategy(boolean parkBackOff)
SpinYieldParkWaitStrategy
public SpinYieldParkWaitStrategy(int spinCount,
int yieldCount)
SpinYieldParkWaitStrategy
public SpinYieldParkWaitStrategy()
waitForOtherThread
public final void waitForOtherThread()
- Description copied from interface:
WaitStrategy
- Do something to wait: busy spinning, yield or sleep.
- Specified by:
waitForOtherThread in interface WaitStrategy
reset
public final void reset()
- Description copied from interface:
WaitStrategy
- Reset the strategy because we have waited and we have accomplished what we were waiting for.
- Specified by:
reset in interface WaitStrategy
Copyright © 2012. All Rights Reserved.