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(long timeout)
Take a resource from the pool.
|
ReferenceCountingResourceHolder<List<T>> |
takeBatch(int elementNum,
long timeout)
Take a resource from the pool.
|
public BlockingPool(com.google.common.base.Supplier<T> generator, int limit)
public int maxSize()
public int getPoolSize()
public ReferenceCountingResourceHolder<T> take(long timeout)
timeout
- maximum time to wait for a resource, in milliseconds. Negative means do not use a timeout.public ReferenceCountingResourceHolder<List<T>> takeBatch(int elementNum, long timeout)
elementNum
- number of resources to taketimeout
- maximum time to wait for resources, in milliseconds. Negative means do not use a timeout.Copyright © 2011–2017. All rights reserved.