org.jboss.cache.lock
Class SemaphoreLock

java.lang.Object
  extended by java.util.concurrent.Semaphore
      extended by org.jboss.cache.lock.SemaphoreLock
All Implemented Interfaces:
Serializable, Lock

public class SemaphoreLock
extends Semaphore
implements Lock

Implements most of the methods of Lock using the Semaphore implementation.

See Also:
Serialized Form

Constructor Summary
SemaphoreLock(int permits)
           
 
Method Summary
 void lock()
           
 void lockInterruptibly()
           
 Condition newCondition()
           
 boolean tryLock()
           
 boolean tryLock(long arg0, TimeUnit arg1)
           
 void unlock()
           
 
Methods inherited from class java.util.concurrent.Semaphore
acquire, acquire, acquireUninterruptibly, acquireUninterruptibly, availablePermits, drainPermits, getQueuedThreads, getQueueLength, hasQueuedThreads, isFair, reducePermits, release, release, toString, tryAcquire, tryAcquire, tryAcquire, tryAcquire
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SemaphoreLock

public SemaphoreLock(int permits)
Method Detail

lock

public void lock()
Specified by:
lock in interface Lock

lockInterruptibly

public void lockInterruptibly()
                       throws InterruptedException
Specified by:
lockInterruptibly in interface Lock
Throws:
InterruptedException

newCondition

public Condition newCondition()
Specified by:
newCondition in interface Lock

tryLock

public boolean tryLock()
Specified by:
tryLock in interface Lock

tryLock

public boolean tryLock(long arg0,
                       TimeUnit arg1)
                throws InterruptedException
Specified by:
tryLock in interface Lock
Throws:
InterruptedException

unlock

public void unlock()
Specified by:
unlock in interface Lock


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.