org.apache.commons.pool.impl
Class FairnessSemaphore

java.lang.Object
  extended by org.apache.commons.pool.impl.FairnessSemaphore

public class FairnessSemaphore
extends java.lang.Object

Semaphore with fairness feature.

Author:
Takayuki Kaneko

Constructor Summary
FairnessSemaphore(int size)
          constructor.
 
Method Summary
 void acquire()
          acquire semaphore with unlimited timeout.
 void acquire(long waitTime)
          acquire semaphore with timeout
 void release()
          release semaphore
 void setSize(int size)
          set semaphore size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FairnessSemaphore

public FairnessSemaphore(int size)
constructor.

Parameters:
size - semaphore size, that assures maximum concurrent thread number
Method Detail

acquire

public void acquire()
             throws java.lang.InterruptedException
acquire semaphore with unlimited timeout.

Throws:
java.lang.InterruptedException

acquire

public void acquire(long waitTime)
             throws java.lang.InterruptedException
acquire semaphore with timeout

Parameters:
waitTime - maximum waiting time before getting semaphore
Throws:
java.lang.InterruptedException

release

public void release()
release semaphore


setSize

public void setSize(int size)
set semaphore size

Parameters:
size - semaphore size


Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.