Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.util
Class ReentrantLock

    java.lang.Object
      javolution.util.ReentrantLock

    public class ReentrantLock

extends java.lang.Object

This class represents a reentrant lock with the same semantics as built-in Java synchronized locks: Once a thread has a lock, it can re-obtain it any number of times without blocking.

Version:
  1.0, October 4, 2004
Author:
  Doug Lea, Jean-Marie Dautelle

Constructor Summary
`ReentrantLock()` Default constructor.

Method Summary
`java.lang.Thread` | `getOwner()` Returns the thread owner of this `ReentrantLock`.
`void` | `lock()` Acquires the lock.
`boolean` | `tryLock()` Acquires the lock only if it not held by another thread.
`void` | `unlock()` Attempts to release this lock.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReentrantLock

    public ReentrantLock()

  Default constructor.

Method Detail

### lock

    public void lock()

  Acquires the lock.

### tryLock

    public boolean tryLock()

  Acquires the lock only if it not held by another thread.

  Returns:
    `true` if the lock was free and was acquired by the current thread, or the lock was already held by the current thread; `false` otherwise.

### unlock

    public void unlock()

  Attempts to release this lock. The lock is actually released if at least as many `unlock()` as `lock()` have been performed on this `ReentrantLock` by the current thread. throws IllegalMonitorStateExeception if the current thread does not hold this lock.

### getOwner

    public java.lang.Thread getOwner()

  Returns the thread owner of this `ReentrantLock`.

  Returns:
    the owner of this lock.

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2007 Javolution.