Commit c52c9a16ed8f657bab260fdd44dbc03200b64eb9
1 parent
fbf51e7d
Shutdown of the MQTT Transport in case of OOM error.
Showing
1 changed file
with
4 additions
and
0 deletions
@@ -717,6 +717,10 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement | @@ -717,6 +717,10 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement | ||
717 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { | 717 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { |
718 | log.error("[{}] Unexpected Exception", sessionId, cause); | 718 | log.error("[{}] Unexpected Exception", sessionId, cause); |
719 | ctx.close(); | 719 | ctx.close(); |
720 | + if (cause instanceof OutOfMemoryError) { | ||
721 | + log.error("Received critical error. Going to shutdown the service."); | ||
722 | + System.exit(1); | ||
723 | + } | ||
720 | } | 724 | } |
721 | 725 | ||
722 | private static MqttSubAckMessage createSubAckMessage(Integer msgId, List<Integer> grantedQoSList) { | 726 | private static MqttSubAckMessage createSubAckMessage(Integer msgId, List<Integer> grantedQoSList) { |