org.mentaqueue.wait
Class ParkWaitStrategy

java.lang.Object
  extended by org.mentaqueue.wait.ParkWaitStrategy
All Implemented Interfaces:
WaitStrategy

public class ParkWaitStrategy
extends Object
implements WaitStrategy

A wait strategy that uses the LockSupport.parkNanos method with some optional backing-off functionality. If backing-off is turned on, the sleepTime will gradually increase by one nanosecond until the strategy is reset.

Author:
Sergio Oliveira Jr.

Constructor Summary
ParkWaitStrategy()
           
ParkWaitStrategy(boolean parkBackOff)
           
 
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
 

Constructor Detail

ParkWaitStrategy

public ParkWaitStrategy(boolean parkBackOff)

ParkWaitStrategy

public ParkWaitStrategy()
Method Detail

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.