org.compass.core.util.backport.java.util.concurrent.locks
Class ReentrantLock.FairSync

java.lang.Object
  extended by org.compass.core.util.backport.java.util.concurrent.locks.ReentrantLock.Sync
      extended by org.compass.core.util.backport.java.util.concurrent.locks.ReentrantLock.FairSync
All Implemented Interfaces:
Serializable, WaitQueue.QueuedSync
Enclosing class:
ReentrantLock

static final class ReentrantLock.FairSync
extends ReentrantLock.Sync
implements WaitQueue.QueuedSync

Sync object for fair locks


Field Summary
 
Fields inherited from class org.compass.core.util.backport.java.util.concurrent.locks.ReentrantLock.Sync
holds_, owner_
 
Constructor Summary
ReentrantLock.FairSync()
           
 
Method Summary
 Collection getQueuedThreads()
           
 int getQueueLength()
           
protected  WaitQueue.WaitNode getSignallee(Thread caller)
           
 boolean hasQueuedThreads()
           
 boolean isFair()
           
 boolean isQueued(Thread thread)
           
 void lock()
          Performs Lock.lock().
 void lockInterruptibly()
           
 boolean recheck(WaitQueue.WaitNode node)
           
 void takeOver(WaitQueue.WaitNode node)
           
 boolean tryLock(long nanos)
           
 void unlock()
           
 
Methods inherited from class org.compass.core.util.backport.java.util.concurrent.locks.ReentrantLock.Sync
getHoldCount, getOwner, incHolds, isHeldByCurrentThread, isLocked, tryLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReentrantLock.FairSync

ReentrantLock.FairSync()
Method Detail

recheck

public boolean recheck(WaitQueue.WaitNode node)
Specified by:
recheck in interface WaitQueue.QueuedSync

takeOver

public void takeOver(WaitQueue.WaitNode node)
Specified by:
takeOver in interface WaitQueue.QueuedSync

lock

public void lock()
Description copied from class: ReentrantLock.Sync
Performs Lock.lock(). The main reason for subclassing is to allow fast path for nonfair version.

Specified by:
lock in class ReentrantLock.Sync

lockInterruptibly

public void lockInterruptibly()
                       throws InterruptedException
Specified by:
lockInterruptibly in class ReentrantLock.Sync
Throws:
InterruptedException

tryLock

public boolean tryLock(long nanos)
                throws InterruptedException
Specified by:
tryLock in class ReentrantLock.Sync
Throws:
InterruptedException

getSignallee

protected WaitQueue.WaitNode getSignallee(Thread caller)

unlock

public void unlock()
Specified by:
unlock in class ReentrantLock.Sync

isFair

public final boolean isFair()
Specified by:
isFair in class ReentrantLock.Sync

hasQueuedThreads

public boolean hasQueuedThreads()
Overrides:
hasQueuedThreads in class ReentrantLock.Sync

getQueueLength

public int getQueueLength()
Overrides:
getQueueLength in class ReentrantLock.Sync

getQueuedThreads

public Collection getQueuedThreads()
Overrides:
getQueuedThreads in class ReentrantLock.Sync

isQueued

public boolean isQueued(Thread thread)
Overrides:
isQueued in class ReentrantLock.Sync


Copyright (c) 2004-2006 The Compass Project.