当前页面:
在线文档首页 >
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
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
Semaphore
public Semaphore(int allowed)
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.