今天在项目里报了一个这样的错
Exception in thread "main" 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.getStatusCodeReply(Connection.java:162)
at redis.clients.jedis.Jedis.set(Jedis.java:51)
at com.rocky.test.TestConnect.main(TestConnect.java:81)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.net.SocketInputStream.read(SocketInputStream.java:107)
at redis.clients.util.RedisInputStream.fill(RedisInputStream.java:109)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:45)
at redis.clients.jedis.Protocol.process(Protocol.java:64)
... 4 more
从网上看了很多资料,最后总结出来就是:因为redis是单线程的,他自己每指定(10000)条数据发生改变就save一下,而在他save的时候我们的java程序一直在让他set,如果等待时间超过了我们设置的时间,他就会报这个错了。