org.jgroups.blocks.locking
Class LockService.LockImpl

java.lang.Object
  extended by org.jgroups.blocks.locking.LockService.LockImpl
All Implemented Interfaces:
java.util.concurrent.locks.Lock
Enclosing class:
LockService

protected class LockService.LockImpl
extends java.lang.Object
implements java.util.concurrent.locks.Lock


Field Summary
protected  java.util.concurrent.atomic.AtomicReference<java.lang.Thread> holder
           
protected  java.lang.String name
           
 
Constructor Summary
LockService.LockImpl(java.lang.String name)
           
 
Method Summary
 void lock()
           
 void lockInterruptibly()
           
 java.util.concurrent.locks.Condition newCondition()
          This condition object is only allowed to work 1 for each lock.
 boolean tryLock()
           
 boolean tryLock(long time, java.util.concurrent.TimeUnit unit)
           
 void unlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name

holder

protected final java.util.concurrent.atomic.AtomicReference<java.lang.Thread> holder
Constructor Detail

LockService.LockImpl

public LockService.LockImpl(java.lang.String name)
Method Detail

lock

public void lock()
Specified by:
lock in interface java.util.concurrent.locks.Lock

lockInterruptibly

public void lockInterruptibly()
                       throws java.lang.InterruptedException
Specified by:
lockInterruptibly in interface java.util.concurrent.locks.Lock
Throws:
java.lang.InterruptedException

tryLock

public boolean tryLock()
Specified by:
tryLock in interface java.util.concurrent.locks.Lock

tryLock

public boolean tryLock(long time,
                       java.util.concurrent.TimeUnit unit)
                throws java.lang.InterruptedException
Specified by:
tryLock in interface java.util.concurrent.locks.Lock
Throws:
java.lang.InterruptedException

unlock

public void unlock()
Specified by:
unlock in interface java.util.concurrent.locks.Lock

newCondition

public java.util.concurrent.locks.Condition newCondition()
This condition object is only allowed to work 1 for each lock. If more than 1 condition is created for this lock, they both will be awaiting/signalling on the same lock

Specified by:
newCondition in interface java.util.concurrent.locks.Lock


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.