Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.utils.common
Class Semaphore

    java.lang.Object
      oracle.ifs.utils.common.Semaphore

    public class Semaphore

extends java.lang.Object

This is an implementation of a semaphore. It provides the basic semaphore operations up() and down(). Semaphores have an internal counter. The up operation always increments this counter. If the counter is positive, then down() decrements the counter. If the counter is not positive, then down() blocks until a call to up() is made. When multiple threads are blocked in a call to down(), one call to up() will allow exactly one of those threads to return from the down() method.

Constructor Summary
`Semaphore()` Construct a Semaphore.
`Semaphore(int n)` Construct a Semaphore with the given counter value.

Method Summary
`boolean` | `down()` Perform a down() operation, as described above.
`boolean` | `down(long timeout)` Perform a down() operation, as described above.
`void` | `up()` Perform an up() operation, as described above.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Semaphore

    public Semaphore()

  Construct a Semaphore. The semaphore constructed has a counter value of zero.

### Semaphore

    public Semaphore(int n)

  Construct a Semaphore with the given counter value.

  Parameters:
    `n` - - the initial value of the internal counter

Method Detail

### down

    public boolean down()
                 throws java.lang.InterruptedException

  Description copied from class: `Semaphore`
  Perform a down() operation, as described above.

  Throws:
    `java.lang.InterruptedException`

### down

    public boolean down(long timeout)
                 throws java.lang.InterruptedException

  Description copied from class: `Semaphore`
  Perform a down() operation, as described above. This version takes an extra parameter which is a timeout. This method will return false if the operation timed out, true on success.

  Throws:
    `java.lang.InterruptedException`

### up

    public void up()

  Description copied from class: `Semaphore`
  Perform an up() operation, as described above.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD