org.apache.james.util
Class Lock

java.lang.Object
  |
  +--org.apache.james.util.Lock

public class Lock
extends Object

Provides Lock functionality

Author:
Federico Barbieri

Constructor Summary
Lock()
           
 
Method Summary
 boolean canI(Object key)
          Check to see if we can lock on a given object.
 boolean isLocked(Object key)
          Check to see if the object is locked
 boolean lock(Object key)
          Lock on a given object.
 boolean unlock(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(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(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(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(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 © 1999-2002 Apache Jakarta Project. All Rights Reserved."