broker/NettyMQTTHandler: code formatter used

This commit is contained in:
Andreas Mager
2017-02-01 17:13:38 +01:00
parent 798fe1e171
commit 539427ddd2
@@ -13,6 +13,7 @@
* *
* You may elect to redistribute this code under either of these licenses. * You may elect to redistribute this code under either of these licenses.
*/ */
package io.moquette.server.netty; package io.moquette.server.netty;
import io.moquette.spi.impl.ProtocolProcessor; import io.moquette.spi.impl.ProtocolProcessor;
@@ -22,10 +23,8 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.mqtt.*; import io.netty.handler.codec.mqtt.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE; import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE;
/** /**
* *
* @author andrea * @author andrea
@@ -75,7 +74,12 @@ public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
m_processor.processPubAck(ctx.channel(), (MqttPubAckMessage) msg); m_processor.processPubAck(ctx.channel(), (MqttPubAckMessage) msg);
break; break;
case PINGREQ: case PINGREQ:
MqttFixedHeader pingHeader = new MqttFixedHeader(MqttMessageType.PINGRESP, false, AT_MOST_ONCE, false, 0); MqttFixedHeader pingHeader = new MqttFixedHeader(
MqttMessageType.PINGRESP,
false,
AT_MOST_ONCE,
false,
0);
MqttMessage pingResp = new MqttMessage(pingHeader); MqttMessage pingResp = new MqttMessage(pingHeader);
ctx.writeAndFlush(pingResp); ctx.writeAndFlush(pingResp);
break; break;
@@ -99,8 +103,11 @@ public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
LOG.error( LOG.error(
"An unexpected exception was caught while processing MQTT message. Closing Netty channel. MqttClientId = {}, cause = {}, errorMessage = {}.", "An unexpected exception was caught while processing MQTT message. "
NettyUtils.clientID(ctx.channel()), cause.getCause(), cause.getMessage()); + "Closing Netty channel. MqttClientId = {}, cause = {}, errorMessage = {}.",
NettyUtils.clientID(ctx.channel()),
cause.getCause(),
cause.getMessage());
ctx.close(); ctx.close();
} }