而我的服务器发生 oom 导致应用程序重新启动,并且 nsqd 也重新启动,**生产者产生消息失败,尝试了 3 次
public void produceRetry(String topic, String msg) {
int i = 0;
while(i < 3) {
try {
this.producer.produce(topic, msg.getBytes(StandardCharsets.UTF_8));
break;
} catch (Exception var7) {
LOG.error(String.format("topic={}发送失败!重试次数:{}", topic, i + 1), var7);
try {
TimeUnit.MILLISECONDS.sleep(20L);
} catch (Exception var6) {
LOG.error("TimeUnit.MILLISECONDS.sleep(20); ERROR!");
}
++i;
}
}
}