Exception in thread "Thread-12" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Software caused connection abort: recv failed
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:202)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
at redis.clients.jedis.Protocol.process(Protocol.java:147)
at redis.clients.jedis.Protocol.read(Protocol.java:211)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:242)
at redis.clients.jedis.JedisPubSub.process(JedisPubSub.java:121)
at redis.clients.jedis.JedisPubSub.proceed(JedisPubSub.java:115)
at redis.clients.jedis.Jedis.subscribe(Jedis.java:2628)
at redis.clients.jedis.JedisCluster$150.execute(JedisCluster.java:1624)
at redis.clients.jedis.JedisCluster$150.execute(JedisCluster.java:1621)
at redis.clients.jedis.JedisClusterCommand.runWithAnyNode(JedisClusterCommand.java:88)
at redis.clients.jedis.JedisCluster.subscribe(JedisCluster.java:1627)
at com.dominos.cloud.pe.utils.RuleDataSource$1.run(RuleDataSource.java:87)
Caused by: java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:196)
... 13 more
场景:
redis subscribe ,网络中断,连接中断后,报此异常,然后不能继续吊费。
public void subscribeRuleChannel() {
redisManager.getJedisCluster().subscribe(new JedisPubSub() {
@Override
public void onMessage(String channel, String message) { //收到消息会调用
System.out.println(String.format("收到消息成功! channel: %s, message: %s", channel, message));
// this.unsubscribe();
//清空本地缓存
}
@Override
public void onSubscribe(String channel, int subscribedChannels) { //订阅频道会调用
System.out.println(String.format("订阅频道成功! channel: %s, subscribedChannels %d",
channel, subscribedChannels));
}
@Override
public void onUnsubscribe(String channel, int subscribedChannels) { //取消订阅会调用
System.out.println(String.format("取消订阅频道! channel: %s, subscribedChannels: %d",
channel, subscribedChannels));
}
}, RULE_CHANNEL);
}