public class CreditsSemaphore extends Object
| Constructor and Description |
|---|
CreditsSemaphore(int initialCredits) |
| Modifier and Type | Method and Description |
|---|---|
void |
acquire() |
int |
getCredits() |
boolean |
hasQueuedThreads() |
void |
release() |
void |
release(int credits) |
void |
setCredits(int credits) |
boolean |
tryAcquire() |
public void acquire()
throws InterruptedException
InterruptedExceptionpublic boolean tryAcquire()
public void release()
throws InterruptedException
InterruptedExceptionpublic void release(int credits)
throws InterruptedException
InterruptedExceptionpublic void setCredits(int credits)
public int getCredits()
public boolean hasQueuedThreads()
Copyright © 2021 The Apache Software Foundation. All rights reserved.