com.trendrr.oss.concurrent
Class ExpirationLock

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

public class ExpirationLock
extends java.lang.Object

Author:
dustin

Constructor Summary
ExpirationLock()
           
 
Method Summary
 java.util.Date getLockUntil()
           
 boolean isLocked()
           
 boolean lockOrSkip(java.util.Date until)
          returns true if the lock was set.
 void lockUntil(java.util.Date date)
          Sets the time that the lock will next be available.
static void main(java.lang.String... args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpirationLock

public ExpirationLock()
Method Detail

main

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

lockOrSkip

public boolean lockOrSkip(java.util.Date until)
returns true if the lock was set. false if the lock was already set by someone else. no need to unlock as the lock expires non-reentrant.

Parameters:
until -
Returns:

lockUntil

public void lockUntil(java.util.Date date)
Sets the time that the lock will next be available.

Parameters:
date -

getLockUntil

public java.util.Date getLockUntil()

isLocked

public boolean isLocked()