public class Semaphore
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
WAIT_FOREVER
Constant for indicating to wait forever on busy semaphore
|
Constructor and Description |
---|
Semaphore() |
Modifier and Type | Method and Description |
---|---|
boolean |
isBusy()
Determine whether this semaphore is busy.
|
void |
setBusy(boolean busy)
Call this method to set the semaphore to busy.
|
boolean |
waitAround(int waitTime)
Return true if the semaphore is still busy after a specified amount of time.
|
public static final int WAIT_FOREVER
public void setBusy(boolean busy)
public boolean isBusy()
public boolean waitAround(int waitTime)
waitTime
- Time (in milliseconds) after which the semaphore returns true if the object is still busy.