org.compass.core.util.backport.java.util.concurrent
Class Semaphore.FairSync

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

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

Fair version


Nested Class Summary
(package private) static class Semaphore.FairSync.Node
           
 
Field Summary
 
Fields inherited from class org.compass.core.util.backport.java.util.concurrent.Semaphore.Sync
permits_
 
Constructor Summary
Semaphore.FairSync(int initialPermits)
           
 
Method Summary
 void acquire(int n)
           
 void acquireUninterruptibly(int n)
           
 boolean attempt(int n, long nanos)
           
 Collection getQueuedThreads()
           
 int getQueueLength()
           
protected  Semaphore.FairSync.Node getSignallee(int n)
           
 boolean hasQueuedThreads()
           
protected  boolean precheck(int n)
           
 boolean recheck(WaitQueue.WaitNode w)
           
 void release(int n)
           
 void takeOver(WaitQueue.WaitNode n)
           
 
Methods inherited from class org.compass.core.util.backport.java.util.concurrent.Semaphore.Sync
attempt, drain, getPermits, reduce
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Semaphore.FairSync

Semaphore.FairSync(int initialPermits)
Method Detail

acquireUninterruptibly

public void acquireUninterruptibly(int n)
Specified by:
acquireUninterruptibly in class Semaphore.Sync

acquire

public void acquire(int n)
             throws InterruptedException
Specified by:
acquire in class Semaphore.Sync
Throws:
InterruptedException

attempt

public boolean attempt(int n,
                       long nanos)
                throws InterruptedException
Specified by:
attempt in class Semaphore.Sync
Throws:
InterruptedException

precheck

protected boolean precheck(int n)

recheck

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

takeOver

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

getSignallee

protected Semaphore.FairSync.Node getSignallee(int n)

release

public void release(int n)
Specified by:
release in class Semaphore.Sync

hasQueuedThreads

public boolean hasQueuedThreads()
Specified by:
hasQueuedThreads in class Semaphore.Sync

getQueueLength

public int getQueueLength()
Specified by:
getQueueLength in class Semaphore.Sync

getQueuedThreads

public Collection getQueuedThreads()
Specified by:
getQueuedThreads in class Semaphore.Sync


Copyright (c) 2004-2006 The Compass Project.