|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.concurrent.Semaphore
com.basho.riak.client.raw.pbc.PoolSemaphore
public class PoolSemaphore
Wraps a semaphore for the cluster and a semaphore for the pool. Used by
RiakConnectionPool
| Constructor Summary | |
|---|---|
PoolSemaphore(Semaphore clusterSemaphore,
int poolPermits)
Creates a pool Semaphore with permits permits. |
|
| Method Summary | |
|---|---|
void |
release()
Both semaphores are released |
boolean |
tryAcquire(int permits)
Tries to acquire from the cluster semaphore, and only if that succeeds does it try the pool semaphore. |
boolean |
tryAcquire(long timeout,
TimeUnit unit)
Tries to acquire on the cluster semaphore, and only if that succeeds does it try the pool semaphore. |
| Methods inherited from class java.util.concurrent.Semaphore |
|---|
acquire, acquire, acquireUninterruptibly, acquireUninterruptibly, availablePermits, drainPermits, getQueuedThreads, getQueueLength, hasQueuedThreads, isFair, reducePermits, release, toString, tryAcquire, tryAcquire |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PoolSemaphore(Semaphore clusterSemaphore,
int poolPermits)
Semaphore with permits permits.
Calls to tryAcquire(long, TimeUnit),
release() and tryAcquire(int) call both cluster and pool
Semaphore
cluster - a Semaphore configured for the total cluster maximum
number of connectionspermits - maximum connections for the pool| Method Detail |
|---|
public void release()
release in class Semaphore
public boolean tryAcquire(long timeout,
TimeUnit unit)
throws InterruptedException
Warning: this means potentially double the timeout
TODO configure option for timeout to be shared (i.e. pool semaphore gets remaining time after cluster acquire)
tryAcquire in class SemaphoreInterruptedExceptionSemaphore.tryAcquire(long,
java.util.concurrent.TimeUnit)public boolean tryAcquire(int permits)
tryAcquire in class SemaphoreSemaphore.tryAcquire(int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||