Package redis.clients.jedis.util
Class Pool<T>
- java.lang.Object
-
- redis.clients.jedis.util.Pool<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
JedisPoolAbstract,ShardedJedisPool
public abstract class Pool<T> extends Object implements Closeable
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.pool2.impl.GenericObjectPool<T>internalPool
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObjects(int count)voidclose()protected voidcloseInternalPool()voiddestroy()longgetMaxBorrowWaitTimeMillis()Returns the maximum waiting time spent by threads to obtain a resource from this pool.longgetMeanBorrowWaitTimeMillis()Returns the mean waiting time spent by threads to obtain a resource from this pool.intgetNumActive()Returns the number of instances currently borrowed from this pool.intgetNumIdle()Returns the number of instances currently idle in this pool.intgetNumWaiters()Returns an estimate of the number of threads currently blocked waiting for a resource from this pool.TgetResource()voidinitPool(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig, org.apache.commons.pool2.PooledObjectFactory<T> factory)booleanisClosed()protected voidreturnBrokenResource(T resource)protected voidreturnBrokenResourceObject(T resource)protected voidreturnResource(T resource)protected voidreturnResourceObject(T resource)
-
-
-
Field Detail
-
internalPool
protected org.apache.commons.pool2.impl.GenericObjectPool<T> internalPool
-
-
Constructor Detail
-
Pool
public Pool()
Using this constructor means you have to set and initialize the internalPool yourself.
-
Pool
public Pool(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig, org.apache.commons.pool2.PooledObjectFactory<T> factory)
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
isClosed
public boolean isClosed()
-
initPool
public void initPool(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig, org.apache.commons.pool2.PooledObjectFactory<T> factory)
-
getResource
public T getResource()
-
returnResourceObject
protected void returnResourceObject(T resource)
-
returnBrokenResource
protected void returnBrokenResource(T resource)
-
returnResource
protected void returnResource(T resource)
-
destroy
public void destroy()
-
returnBrokenResourceObject
protected void returnBrokenResourceObject(T resource)
-
closeInternalPool
protected void closeInternalPool()
-
getNumActive
public int getNumActive()
Returns the number of instances currently borrowed from this pool.- Returns:
- The number of instances currently borrowed from this pool, -1 if the pool is inactive.
-
getNumIdle
public int getNumIdle()
Returns the number of instances currently idle in this pool.- Returns:
- The number of instances currently idle in this pool, -1 if the pool is inactive.
-
getNumWaiters
public int getNumWaiters()
Returns an estimate of the number of threads currently blocked waiting for a resource from this pool.- Returns:
- The number of threads waiting, -1 if the pool is inactive.
-
getMeanBorrowWaitTimeMillis
public long getMeanBorrowWaitTimeMillis()
Returns the mean waiting time spent by threads to obtain a resource from this pool.- Returns:
- The mean waiting time, in milliseconds, -1 if the pool is inactive.
-
getMaxBorrowWaitTimeMillis
public long getMaxBorrowWaitTimeMillis()
Returns the maximum waiting time spent by threads to obtain a resource from this pool.- Returns:
- The maximum waiting time, in milliseconds, -1 if the pool is inactive.
-
addObjects
public void addObjects(int count)
-
-