uk.co.mmscomputing.concurrent
Class Semaphore

java.lang.Object
  extended by uk.co.mmscomputing.concurrent.Semaphore
Direct Known Subclasses:
Timer

public class Semaphore
extends java.lang.Object


Constructor Summary
Semaphore(int permits, boolean fair)
           
 
Method Summary
 void acquire()
           
 int availablePermits()
           
 boolean isFair()
           
 void release()
           
 void release(int permits)
           
 boolean tryAcquire(long timeout, TimeUnit unit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Semaphore

public Semaphore(int permits,
                 boolean fair)
Method Detail

isFair

public boolean isFair()

availablePermits

public int availablePermits()

acquire

public void acquire()
             throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

tryAcquire

public boolean tryAcquire(long timeout,
                          TimeUnit unit)
                   throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

release

public void release()

release

public void release(int permits)


Copyright © 2011 Direcció General de Tecnologia i Comunicacions. Govern de les Illes Balears. All Rights Reserved.