diff --git a/src/dorkbox/network/connection/registration/local/RegistrationLocalHandler.java b/src/dorkbox/network/connection/registration/local/RegistrationLocalHandler.java index 28faf11a..3058ec08 100644 --- a/src/dorkbox/network/connection/registration/local/RegistrationLocalHandler.java +++ b/src/dorkbox/network/connection/registration/local/RegistrationLocalHandler.java @@ -17,8 +17,6 @@ package dorkbox.network.connection.registration.local; import static dorkbox.network.connection.EndPointBase.maxShutdownWaitTimeInMilliSeconds; -import org.slf4j.Logger; - import dorkbox.network.connection.Connection; import dorkbox.network.connection.RegistrationWrapper; import dorkbox.network.connection.registration.MetaChannel; @@ -50,14 +48,11 @@ class RegistrationLocalHandler extends RegistrationHandler MetaChannel metaChannel = new MetaChannel(); metaChannel.localChannel = channel; - this.registrationWrapper.addChannel(channel.hashCode(), metaChannel); + registrationWrapper.addChannel(channel.hashCode(), metaChannel); - Logger logger2 = this.logger; - if (logger2.isTraceEnabled()) { - logger2.trace("New LOCAL connection."); - } + logger.trace("New LOCAL connection."); - this.registrationWrapper.connection0(metaChannel); + registrationWrapper.connection0(metaChannel); } @Override @@ -65,10 +60,10 @@ class RegistrationLocalHandler extends RegistrationHandler void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception { Channel channel = context.channel(); - this.logger.error( - "Unexpected exception while trying to receive data on LOCAL channel. ({})" + System.getProperty("line.separator"), - channel.remoteAddress(), - cause); + logger.error("Unexpected exception while trying to receive data on LOCAL channel. ({})" + System.getProperty("line.separator"), + channel.remoteAddress(), + cause); + if (channel.isOpen()) { channel.close(); } @@ -86,7 +81,7 @@ class RegistrationLocalHandler extends RegistrationHandler void channelInactive(ChannelHandlerContext context) throws Exception { Channel channel = context.channel(); - this.logger.info("Closed LOCAL connection: {}", channel.remoteAddress()); + logger.info("Closed LOCAL connection: {}", channel.remoteAddress()); // also, once we notify, we unregister this. registrationWrapper.closeChannel(channel, maxShutdownWaitTimeInMilliSeconds); diff --git a/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerClient.java b/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerClient.java index d641f833..44dbbafb 100644 --- a/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerClient.java +++ b/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerClient.java @@ -50,10 +50,10 @@ class RegistrationLocalHandlerClient extends RegistrationL super.channelActive(context); Channel channel = context.channel(); - this.logger.info("Connected to LOCAL connection. [{} ==> {}]", - context.channel() - .localAddress(), - channel.remoteAddress()); + logger.info("Connected to LOCAL connection. [{} ==> {}]", + context.channel() + .localAddress(), + channel.remoteAddress()); // client starts the registration process channel.writeAndFlush(new Registration()); diff --git a/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerServer.java b/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerServer.java index 31748bd7..429caac1 100644 --- a/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerServer.java +++ b/src/dorkbox/network/connection/registration/local/RegistrationLocalHandlerServer.java @@ -23,7 +23,6 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPipeline; import io.netty.util.ReferenceCountUtil; -import org.slf4j.Logger; public class RegistrationLocalHandlerServer extends RegistrationLocalHandler { @@ -48,10 +47,10 @@ class RegistrationLocalHandlerServer extends RegistrationL public void channelActive(ChannelHandlerContext context) throws Exception { Channel channel = context.channel(); - this.logger.info("Connected to LOCAL connection. [{} <== {}]", - context.channel() - .localAddress(), - channel.remoteAddress()); + logger.info("Connected to LOCAL connection. [{} <== {}]", + context.channel() + .localAddress(), + channel.remoteAddress()); super.channelActive(context); @@ -70,13 +69,10 @@ class RegistrationLocalHandlerServer extends RegistrationL channel.writeAndFlush(message); ReferenceCountUtil.release(message); - Logger logger2 = this.logger; - if (logger2.isTraceEnabled()) { - logger2.trace("Sent registration"); - } + logger.trace("Sent registration"); ConnectionImpl connection = null; - MetaChannel metaChannel = this.registrationWrapper.removeChannel(channel.hashCode()); + MetaChannel metaChannel = registrationWrapper.removeChannel(channel.hashCode()); if (metaChannel != null) { connection = metaChannel.connection; } @@ -99,7 +95,7 @@ class RegistrationLocalHandlerServer extends RegistrationL // have to setup connection handler pipeline.addLast(CONNECTION_HANDLER, connection); - this.registrationWrapper.connectionConnected0(connection); + registrationWrapper.connectionConnected0(connection); } } }