public class BlockingPool<T> extends Object
| Constructor and Description |
|---|
BlockingPool(com.google.common.base.Supplier<T> generator,
int limit) |
| Modifier and Type | Method and Description |
|---|---|
int |
getPoolSize() |
int |
maxSize() |
ReferenceCountingResourceHolder<T> |
take()
Take a resource from the pool, waiting if necessary until an element becomes available.
|
ReferenceCountingResourceHolder<T> |
take(long timeoutMs)
Take a resource from the pool, waiting up to the
specified wait time if necessary for an element to become available.
|
ReferenceCountingResourceHolder<List<T>> |
takeBatch(int elementNum)
Take resources from the pool, waiting if necessary until the elements of the given number become available.
|
ReferenceCountingResourceHolder<List<T>> |
takeBatch(int elementNum,
long timeoutMs)
Take resources from the pool, waiting up to the
specified wait time if necessary for elements of the given number to become available.
|
public BlockingPool(com.google.common.base.Supplier<T> generator, int limit)
public int maxSize()
public int getPoolSize()
public ReferenceCountingResourceHolder<T> take(long timeoutMs)
timeoutMs - maximum time to wait for a resource, in milliseconds.public ReferenceCountingResourceHolder<T> take()
public ReferenceCountingResourceHolder<List<T>> takeBatch(int elementNum, long timeoutMs)
elementNum - number of resources to taketimeoutMs - maximum time to wait for resources, in milliseconds.public ReferenceCountingResourceHolder<List<T>> takeBatch(int elementNum)
elementNum - number of resources to takeCopyright © 2011–2017. All rights reserved.