org.iges.util
Interface Lock

All Known Implementing Classes:
ExclusiveLock

public interface Lock

A generalized representation of the thread-lock concept. This can be used to create other locking systems besides the basic one-thread-at-a-time model of Java's synchronized keyword.


Method Summary
 boolean isLocked()
           
 void lock()
          Obtains this lock for the current thread, blocking until the lock is available.
 void release()
          Releases this lock.
 boolean tryLock()
          Tries to obtain this lock for the current thread.
 

Method Detail

isLocked

public boolean isLocked()
Returns:
True if the current thread owns this lock.

lock

public void lock()
Obtains this lock for the current thread, blocking until the lock is available.


release

public void release()
Releases this lock. If the current thread does not own this lock, does nothing.


tryLock

public boolean tryLock()
Tries to obtain this lock for the current thread. This method always returns immediately but does not guarantee that the lock will be obtained.

Returns:
True if the lock was succesfully obtained.