Knopflerfish OSGi 3.0.0

org.knopflerfish.util
Class Semaphore

java.lang.Object
  extended by org.knopflerfish.util.Semaphore

public class Semaphore
extends java.lang.Object

The Semaphore class handles synchronization and waiting for values.

Author:
Johan Agat and Anders Rimen

Constructor Summary
Semaphore()
           
 
Method Summary
 void close()
           
 java.lang.Object get(long timeout)
          Waits up to timeout milliseconds for this Semaphore to receive a value.
 void reset()
           
 void set(java.lang.Object v)
          Sets the value of this Semaphore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Semaphore

public Semaphore()
Method Detail

get

public java.lang.Object get(long timeout)
Waits up to timeout milliseconds for this Semaphore to receive a value.

Returns:
The value of the Semaphore or null if this Semaphore has been closed or if the specified timeout has expired.

set

public void set(java.lang.Object v)
Sets the value of this Semaphore. This will cause all blocked calls to get(long) to return the value. If set(Object) is called several times with a short or no delay between the calls, the exact value returned by a given blocked call to get(long) is not deterministic.

Parameters:
v - The new value.

reset

public void reset()

close

public void close()

Knopflerfish OSGi 3.0.0