Minor refact, moved commons Channel attributes constants from NettyChannel to NettyUtils

This commit is contained in:
andsel
2016-01-24 19:21:24 +01:00
parent aa94d47148
commit 43371d3068
6 changed files with 58 additions and 149 deletions
@@ -87,12 +87,12 @@ public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
String clientID = (String) NettyUtils.getAttribute(ctx, NettyChannel.ATTR_KEY_CLIENTID);
String clientID = (String) NettyUtils.getAttribute(ctx, NettyUtils.ATTR_KEY_CLIENTID);
if (clientID != null && !clientID.isEmpty()) {
//if the channel was of a correctly connected client, inform messaging
//else it was of a not completed CONNECT message or sessionStolen
boolean stolen = false;
Boolean stolenAttr = (Boolean) NettyUtils.getAttribute(ctx, NettyChannel.ATTR_KEY_SESSION_STOLEN);
Boolean stolenAttr = (Boolean) NettyUtils.getAttribute(ctx, NettyUtils.ATTR_KEY_SESSION_STOLEN);
if (stolenAttr != null && stolenAttr == Boolean.TRUE) {
stolen = stolenAttr;
}