com.trendrr.oss.concurrent
Class TrendrrLock

java.lang.Object
  extended by com.trendrr.oss.concurrent.TrendrrLock

public class TrendrrLock
extends java.lang.Object

Author:
dustin

Constructor Summary
TrendrrLock()
           
 
Method Summary
 boolean isLocked()
           
 boolean lockOnce()
          used for lazy initializations.
 boolean lockOrSkip()
          returns true if lock was obtained, false otherwise.
 void lockOrWait()
           
static void main(java.lang.String... args)
           
 void resetLockOnce()
          use this to reset the value for lockOnce..
 void setLockOnce(boolean val)
          set to true if you say the the lock has already been gotten
 void unlock()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrendrrLock

public TrendrrLock()
Method Detail

main

public static void main(java.lang.String... args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

lockOrSkip

public boolean lockOrSkip()
returns true if lock was obtained, false otherwise.

Returns:

isLocked

public boolean isLocked()

lockOrWait

public void lockOrWait()

unlock

public void unlock()

lockOnce

public boolean lockOnce()
used for lazy initializations. will block if and only if initialization is currently happening. returns true if successfully locked, false otherwise remember to unlock! reset by calling resetLockOnce();


resetLockOnce

public void resetLockOnce()
use this to reset the value for lockOnce..

Parameters:
val -

setLockOnce

public void setLockOnce(boolean val)
set to true if you say the the lock has already been gotten

Parameters:
val -