Redis报错:redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out
Problem Description:
Ali goes on linux server (the cheapest kind of ...), the use of cache implementation redis thumbs up function error, due to redis thought it was not deep enough profile, ignoring the code. .
Exception information:
redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out at redis.clients.jedis.Protocol.process(Protocol.java:79) at redis.clients.jedis.Protocol.read(Protocol.java:131) at redis.clients.jedis.Connection.getIntegerReply(Connection.java:188) at redis.clients.jedis.Jedis.sismember(Jedis.java:1266)
problem solved:
Perform close () after you are finished using jedis
Case Study:
public String set(String key, String value) { // TODO Auto-generated method stub Jedis jedis =jedisPool.getResource(); String result =jedis.set(key, value); jedis.close(); return result; } @Override public String get(String key) { // TODO Auto-generated method stub Jedis jedis =jedisPool.getResource(); String result =jedis.get(key); jedis.close(); return result; }
Note: After each use to close out, jedisPool not closed, otherwise it will error, can not access resources