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

## org.jboss.util
Class Semaphore

    java.lang.Object
      org.jboss.util.Semaphore

All Implemented Interfaces:
  Sync

Direct Known Subclasses:
  WaitSemaphore

public class Semaphore
extends Object
implements Sync

Semaphore that can allow a specified number of threads to enter, blocking the others. If the specified number of threads is 1, it acts as an exclusive semaphore and can be used instead of synchronized blocks

Version:
  $Revision: 1.1 $
Author:
  Simone Bordet

Constructor Summary
`Semaphore(int allowed)`

Method Summary
`void` | `acquire()` Acquires this sync
`int` | `getUsers()`
`protected void` | `logAcquire()`
`protected void` | `logDeadlock()`
`protected void` | `logRelease()`
`void` | `release()` Releases this sync
`String` | `toString()`
`protected boolean` | `waitImpl(Object lock)`

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

Constructor Detail

### Semaphore

    public Semaphore(int allowed)

Method Detail

### getUsers

    public int getUsers()

### acquire

    public void acquire()
                 throws InterruptedException

  Description copied from interface: `Sync`
  Acquires this sync

  Specified by:
    `acquire` in interface `Sync`
  Throws:
    `InterruptedException`
  See Also:
    `Sync.release()`

### release

    public void release()

  Description copied from interface: `Sync`
  Releases this sync

  Specified by:
    `release` in interface `Sync`
  See Also:
    `Sync.acquire()`

### toString

    public String toString()

### waitImpl

    protected boolean waitImpl(Object lock)
                        throws InterruptedException

  Throws:
    `InterruptedException`

### logAcquire

    protected void logAcquire()

### logDeadlock

    protected void logDeadlock()

### logRelease

    protected void logRelease()

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

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.