public static JedisPool getJedisPool(int db) {
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setBlockWhenExhausted(true);
poolConfig.setTimeBetweenEvictionRunsMillis(10000);
poolConfig.setMinIdle(1);
poolConfig.setMaxIdle(3);
poolConfig.setMaxTotal(5);
return new JedisPool(poolConfig, "127.0.0.1", 6363, 5000, "", db);
}
Jedis redis = null;
try {
// "pool" is obtained early in the app by calling getJedisPool(int).
// This call is failing:
redis = pool.getResource();
// Work with redis.
...
} finally {
if(null != redis) {
redis.close();
redis = null;
}
}
java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:449)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
at redis.clients.util.Pool.getResource(Pool.java:49)
at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226)
...
at java.lang.Thread.run(Thread.java:745)
Hi Ori,
I would also recommend setting Redis server timeout to 0. In my case, this made to go away all timeout errors
Best,
jordi
--
You received this message because you are subscribed to the Google Groups "Jedis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jedis_redis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.