Shutdown of the MQTT Transport in case of OOM error.

This commit is contained in:
Andrii Shvaika 2021-09-29 12:16:39 +03:00
parent fbf51e7df5
commit c52c9a16ed

View File

@ -717,6 +717,10 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
log.error("[{}] Unexpected Exception", sessionId, cause);
ctx.close();
if (cause instanceof OutOfMemoryError) {
log.error("Received critical error. Going to shutdown the service.");
System.exit(1);
}
}
private static MqttSubAckMessage createSubAckMessage(Integer msgId, List<Integer> grantedQoSList) {