This commit is contained in:
梁显优 2023-04-17 02:11:07 +08:00 committed by 绝尘
parent e8b9140103
commit e2c2b62665

View File

@ -298,24 +298,26 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer
// send msg
new Thread(() -> {
String msg = null;
try {
msg = sendMsgQueue.take();
writer.write(msg.getBytes(UTF_8));
writer.flush();
} catch (InterruptedException | IOException e) {
logger.log(Level.WARNING, "send-msg[" + msg + "] event accept error :", e);
while (true) {
String msg = null;
try {
Thread.sleep(3000);
assert msg != null;
msg = sendMsgQueue.take();
writer.write(msg.getBytes(UTF_8));
writer.flush();
} catch (IOException | InterruptedException | NullPointerException ex) {
e.printStackTrace();
} catch (InterruptedException | IOException e) {
logger.log(Level.WARNING, "send-msg[" + msg + "] event accept error :", e);
try {
Thread.sleep(3000);
assert msg != null;
writer.write(msg.getBytes(UTF_8));
writer.flush();
} catch (IOException | InterruptedException | NullPointerException ex) {
e.printStackTrace();
}
}
}
});
}).start();
}