org.apache.james.util
Class Lock

java.lang.Object
  extended by org.apache.james.util.Lock

public class Lock
extends java.lang.Object

Provides Lock functionality


Constructor Summary
Lock()
           
 
Method Summary
 boolean canI(java.lang.Object key)
          Check to see if we can lock on a given object.
 boolean isLocked(java.lang.Object key)
          Check to see if the object is locked
 boolean lock(java.lang.Object key)
          Lock on a given object.
 boolean unlock(java.lang.Object key)
          Release the lock on a given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Lock

public Lock()
Method Detail

isLocked

public boolean isLocked(java.lang.Object key)
Check to see if the object is locked

Parameters:
key - the Object on which to check the lock
Returns:
true if the object is locked, false otherwise

canI

public boolean canI(java.lang.Object key)
Check to see if we can lock on a given object.

Parameters:
key - the Object on which to lock
Returns:
true if the calling thread can lock, false otherwise

lock

public boolean lock(java.lang.Object key)
Lock on a given object.

Parameters:
key - the Object on which to lock
Returns:
true if the locking was successful, false otherwise

unlock

public boolean unlock(java.lang.Object key)
Release the lock on a given object.

Parameters:
key - the Object on which the lock is held
Returns:
true if the unlocking was successful, false otherwise


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.