public final class PoolUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
PoolUtils.PoolWork<T,V>
A unit of work that utilizes a pooled resource.
|
| Modifier and Type | Method and Description |
|---|---|
static redis.clients.util.Pool<redis.clients.jedis.Jedis> |
createJedisPool(Config jesqueConfig)
A simple helper method that creates a pool of connections to Redis using
the supplied Config and the default pool config.
|
static redis.clients.util.Pool<redis.clients.jedis.Jedis> |
createJedisPool(Config jesqueConfig,
org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
A simple helper method that creates a pool of connections to Redis using
the supplied configurations.
|
static <V> V |
doWorkInPool(redis.clients.util.Pool<redis.clients.jedis.Jedis> pool,
PoolUtils.PoolWork<redis.clients.jedis.Jedis,V> work)
Perform the given work with a Jedis connection from the given pool.
|
static <V> V |
doWorkInPoolNicely(redis.clients.util.Pool<redis.clients.jedis.Jedis> pool,
PoolUtils.PoolWork<redis.clients.jedis.Jedis,V> work)
Perform the given work with a Jedis connection from the given pool.
|
static org.apache.commons.pool2.impl.GenericObjectPoolConfig |
getDefaultPoolConfig() |
public static <V> V doWorkInPool(redis.clients.util.Pool<redis.clients.jedis.Jedis> pool,
PoolUtils.PoolWork<redis.clients.jedis.Jedis,V> work)
throws Exception
V - the result typepool - the resource poolwork - the work to performException - if something went wrongpublic static <V> V doWorkInPoolNicely(redis.clients.util.Pool<redis.clients.jedis.Jedis> pool,
PoolUtils.PoolWork<redis.clients.jedis.Jedis,V> work)
V - the result typepool - the resource poolwork - the work to performpublic static org.apache.commons.pool2.impl.GenericObjectPoolConfig getDefaultPoolConfig()
public static redis.clients.util.Pool<redis.clients.jedis.Jedis> createJedisPool(Config jesqueConfig)
jesqueConfig - the config used to create the pooled Jedis connectionpublic static redis.clients.util.Pool<redis.clients.jedis.Jedis> createJedisPool(Config jesqueConfig, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
jesqueConfig - the config used to create the pooled Jedis connectionspoolConfig - the config used to create the poolCopyright © 2011–2019. All rights reserved.