站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

Semaphore (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util
Class Semaphore

java.lang.Object
  extended byorg.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()


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