public final class Token
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
acquire()
Acquires this token, blocking if necessary until it is available.
|
static Token |
newBlockedToken()
Creates and returns a new token, initially "blocked", i.e.
|
static Token |
newUnblockedToken()
Creates and returns a new token, initially "unblocked", i.e.
|
void |
release()
Releases this token, possibly unblocking a thread currently
attempting to
acquire() it. |
public final void acquire()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic final void release()
throws java.lang.IllegalStateException
acquire() it.java.lang.IllegalStateExceptionpublic static final Token newBlockedToken()
public static final Token newUnblockedToken()