Redis uses connection pool error Solution
Redis has been reporting exceptions for more than 10 hours.
Redis. clients. jedis. exceptions. jedisconnectionexception: cocould not get a resource from the pool at redis. clients. util. pool. getresource (pool. java: 22) at com. derbysoft. jredis. longkeytest. borrowobject. run (borrowobject. java: 22) at java. lang. thread. run (thread. java: 662) caused by: Java. util. nosuchelementexception: timeout waiting for idle object at Org. apache. commons. pool. impl. genericobjectpool. borrowobject (genericobjectpool. java: 1134) at redis. clients. util. pool. getresource (pool. java: 20)
The reason is that resources are not recycled.
The correct method is
Shardedjedis Jedis = shardedjedispool. getresource (); try {Jedis. Set (Key, value) ;}finally {shardedjedispool. returnresource (Jedis );}
Redis uses connection pool error Solution