Missed logger trace and info wrappers. Added them

This commit is contained in:
nathan 2014-08-22 14:04:38 +02:00
parent 43e77086d0
commit 2a1e4d674f
12 changed files with 148 additions and 72 deletions

View File

@ -281,6 +281,7 @@ public class Client extends EndPointClient {
bootstrapWrapper.bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeout);
}
Logger logger2 = this.logger;
try {
// UDP : When this is CONNECT on a udp socket will ONLY accept UDP traffic from the remote address (ip/port combo).
// If the reply isn't from the correct port, then the other end will receive a "Port Unreachable" exception.
@ -289,10 +290,10 @@ public class Client extends EndPointClient {
future.await();
} catch (Exception e) {
if (this.logger.isDebugEnabled()) {
this.logger.error("Could not connect to the {} server on port {}.", bootstrapWrapper.type, bootstrapWrapper.port, e.getCause());
if (logger2.isDebugEnabled()) {
logger2.debug("Could not connect to the {} server on port {}.", bootstrapWrapper.type, bootstrapWrapper.port, e.getCause());
} else {
this.logger.error("Could not connect to the {} server{}.", bootstrapWrapper.type, bootstrapWrapper.port);
logger2.error("Could not connect to the {} server{}.", bootstrapWrapper.type, bootstrapWrapper.port);
}
this.registrationInProgress = false;
@ -301,10 +302,10 @@ public class Client extends EndPointClient {
}
if (!future.isSuccess()) {
if (this.logger.isDebugEnabled()) {
this.logger.error("Could not connect to the {} server.", bootstrapWrapper.type, future.cause());
if (logger2.isDebugEnabled()) {
logger2.debug("Could not connect to the {} server.", bootstrapWrapper.type, future.cause());
} else {
this.logger.error("Could not connect to the {} server.", bootstrapWrapper.type);
logger2.error("Could not connect to the {} server.", bootstrapWrapper.type);
}
this.registrationInProgress = false;
@ -312,7 +313,9 @@ public class Client extends EndPointClient {
return;
}
this.logger.trace("Waiting for registration from server.");
if (logger2.isTraceEnabled()) {
logger2.trace("Waiting for registration from server.");
}
manageForShutdown(future);
// WAIT for the next one to complete.

View File

@ -160,7 +160,10 @@ public class ConnectionManager implements ListenerBridge, ISessionManager {
public final void removeAll() {
this.listeners.clear();
this.logger.trace("all listeners removed !!");
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("all listeners removed !!");
}
}
/**
@ -176,7 +179,10 @@ public class ConnectionManager implements ListenerBridge, ISessionManager {
this.listeners.remove(classType);
this.logger.trace("all listeners removed for type: {}", classType.getClass().getName());
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("all listeners removed for type: {}", classType.getClass().getName());
}
}

View File

@ -1,5 +1,7 @@
package dorkbox.network.connection;
import org.slf4j.Logger;
import dorkbox.network.ConnectionOptions;
import dorkbox.network.util.InitializationException;
import dorkbox.network.util.SecurityException;
@ -34,7 +36,10 @@ public class EndPointClient extends EndPointWithSerialization {
}
}
this.logger.trace("Registered protocol from server.");
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("Registered protocol from server.");
}
// only let us continue with connections (this starts up the client/server implementations) once ALL of the
// bootstraps have connected

View File

@ -1,5 +1,7 @@
package dorkbox.network.connection.ping;
import org.slf4j.Logger;
import dorkbox.network.connection.ConnectionImpl;
import dorkbox.network.connection.Listener;
@ -7,16 +9,21 @@ public class PingListener extends Listener<ConnectionImpl, PingMessage> {
private final org.slf4j.Logger logger;
public PingListener(String name) {
logger = org.slf4j.LoggerFactory.getLogger(name);
this.logger = org.slf4j.LoggerFactory.getLogger(name);
}
@Override
public void received(ConnectionImpl connection, PingMessage ping) {
Logger logger2 = this.logger;
if (ping.isReply) {
logger.trace("Received a reply to my issued ping request.");
if (logger2.isTraceEnabled()) {
logger2.trace("Received a reply to my issued ping request.");
}
connection.updatePingResponse(ping);
} else {
logger.trace( "Received a ping from {}", connection);
if (logger2.isTraceEnabled()) {
logger2.trace( "Received a ping from {}", connection);
}
ping.isReply = true;
connection.ping0(ping);

View File

@ -1,5 +1,7 @@
package dorkbox.network.connection.registration.local;
import org.slf4j.Logger;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
@ -25,15 +27,18 @@ public abstract class RegistrationLocalHandler extends RegistrationHandler {
metaChannel.localChannel = channel;
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
channelMap.put(channel.hashCode(), metaChannel);
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
logger.trace("New LOCAL connection.");
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("New LOCAL connection.");
}
registrationWrapper.connection0(metaChannel);
this.registrationWrapper.connection0(metaChannel);
// have to setup connection handler
ChannelPipeline pipeline = channel.pipeline();
@ -45,7 +50,7 @@ public abstract class RegistrationLocalHandler extends RegistrationHandler {
*/
@Override
public void channelActive(ChannelHandlerContext context) throws Exception {
if (logger.isDebugEnabled()) {
if (this.logger.isDebugEnabled()) {
Channel channel = context.channel();
StringBuilder builder = new StringBuilder(76);
@ -55,7 +60,7 @@ public abstract class RegistrationLocalHandler extends RegistrationHandler {
builder.append(channel.remoteAddress());
builder.append("]");
logger.debug(builder.toString());
this.logger.debug(builder.toString());
}
}
@ -70,14 +75,14 @@ public abstract class RegistrationLocalHandler extends RegistrationHandler {
public final void channelInactive(ChannelHandlerContext context) throws Exception {
Channel channel = context.channel();
logger.info("Closed LOCAL connection: {}", channel.remoteAddress());
this.logger.info("Closed LOCAL connection: {}", channel.remoteAddress());
long maxShutdownWaitTimeInMilliSeconds = EndPoint.maxShutdownWaitTimeInMilliSeconds;
// also, once we notify, we unregister this.
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
Entries<MetaChannel> entries = channelMap.entries();
while (entries.hasNext()) {
MetaChannel metaChannel = entries.next().value;
@ -89,7 +94,7 @@ public abstract class RegistrationLocalHandler extends RegistrationHandler {
}
}
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
super.channelInactive(context);
@ -99,7 +104,7 @@ public abstract class RegistrationLocalHandler extends RegistrationHandler {
public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception {
Channel channel = context.channel();
logger.error("Unexpected exception while trying to receive data on LOCAL channel. ({})" + System.getProperty("line.separator"), channel.remoteAddress(), cause);
this.logger.error("Unexpected exception while trying to receive data on LOCAL channel. ({})" + System.getProperty("line.separator"), channel.remoteAddress(), cause);
if (channel.isOpen()) {
channel.close();
}

View File

@ -4,6 +4,9 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.util.ReferenceCountUtil;
import org.slf4j.Logger;
import dorkbox.network.connection.Connection;
import dorkbox.network.connection.RegistrationWrapper;
import dorkbox.network.connection.registration.MetaChannel;
@ -27,21 +30,24 @@ public class RegistrationLocalHandlerServer extends RegistrationLocalHandler {
channel.writeAndFlush(message);
ReferenceCountUtil.release(message);
logger.trace("Sent registration");
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("Sent registration");
}
Connection connection = null;
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
MetaChannel metaChannel = channelMap.remove(channel.hashCode());
if (metaChannel != null) {
connection = metaChannel.connection;
}
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (connection != null) {
registrationWrapper.connectionConnected0(connection);
this.registrationWrapper.connectionConnected0(connection);
}
}

View File

@ -17,6 +17,7 @@ import org.bouncycastle.crypto.engines.IESEngine;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.spec.ECParameterSpec;
import org.slf4j.Logger;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
@ -104,7 +105,8 @@ public class RegistrationRemoteHandlerClientTCP extends RegistrationRemoteHandle
*/
@Override
public void channelActive(ChannelHandlerContext context) throws Exception {
if (this.logger.isDebugEnabled()) {
Logger logger2 = this.logger;
if (logger2.isDebugEnabled()) {
super.channelActive(context);
}
@ -125,7 +127,9 @@ public class RegistrationRemoteHandlerClientTCP extends RegistrationRemoteHandle
this.registrationWrapper.releaseChannelMap();
}
this.logger.trace("Start new TCP Connection. Sending request to server");
if (logger2.isTraceEnabled()) {
logger2.trace("Start new TCP Connection. Sending request to server");
}
Registration registration = new Registration();
registration.publicKey = this.registrationWrapper.getPublicKey();
@ -316,7 +320,10 @@ public class RegistrationRemoteHandlerClientTCP extends RegistrationRemoteHandle
channel.eventLoop().schedule(new Runnable() {
@Override
public void run() {
RegistrationRemoteHandlerClientTCP.this.logger.trace("Notify Connection");
Logger logger2 = RegistrationRemoteHandlerClientTCP.this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("Notify Connection");
}
notifyConnection(metaChannel2);
}}, metaChannel.getNanoSecBetweenTCP() * 2, TimeUnit.NANOSECONDS);
}

View File

@ -8,6 +8,8 @@ import io.netty.util.ReferenceCountUtil;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.slf4j.Logger;
import dorkbox.network.connection.RegistrationWrapper;
import dorkbox.network.connection.registration.MetaChannel;
import dorkbox.network.connection.registration.Registration;
@ -30,15 +32,18 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
*/
@Override
protected void initChannel(Channel channel) {
logger.trace("Channel registered: " + channel.getClass().getSimpleName());
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("Channel registered: " + channel.getClass().getSimpleName());
}
ChannelPipeline pipeline = channel.pipeline();
// UDP
// add first to "inject" these handlers in front of myself.
// this is only called ONCE for UDP for the CLIENT.
pipeline.addFirst(RegistrationRemoteHandler.KRYO_DECODER, new KryoDecoderUdp(serializationManager));
pipeline.addFirst(RegistrationRemoteHandler.KRYO_ENCODER, new KryoEncoderUdp(serializationManager));
pipeline.addFirst(RegistrationRemoteHandler.KRYO_DECODER, new KryoDecoderUdp(this.serializationManager));
pipeline.addFirst(RegistrationRemoteHandler.KRYO_ENCODER, new KryoEncoderUdp(this.serializationManager));
}
/**
@ -46,7 +51,8 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
*/
@Override
public void channelActive(ChannelHandlerContext context) throws Exception {
if (logger.isDebugEnabled()) {
Logger logger2 = this.logger;
if (logger2.isDebugEnabled()) {
super.channelActive(context);
}
@ -64,7 +70,7 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
Entries<MetaChannel> entries = channelMap.entries();
while (entries.hasNext()) {
MetaChannel metaChannel = entries.next().value;
@ -80,14 +86,16 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
}
}
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (!success) {
throw new RuntimeException("UDP cannot connect to a remote server before TCP is established!");
}
logger.trace("Start new UDP Connection. Sending request to server");
if (logger2.isTraceEnabled()) {
logger2.trace("Start new UDP Connection. Sending request to server");
}
Registration registration = new Registration();
// client start the handshake with a registration packet
@ -105,10 +113,10 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
MetaChannel metaChannel = null;
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
metaChannel = channelMap.get(channel.hashCode());
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (metaChannel != null) {
@ -120,8 +128,8 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
OptimizeUtils optimizeUtils = OptimizeUtils.get();
if (!optimizeUtils.canReadInt(payload)) {
logger.error("Invalid decryption of connection ID. Aborting.");
shutdown(registrationWrapper, channel);
this.logger.error("Invalid decryption of connection ID. Aborting.");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
return;
@ -131,17 +139,17 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
MetaChannel metaChannel2 = null;
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
metaChannel2 = channelMap.get(connectionID);
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (metaChannel2 != null) {
// hooray! we are successful
// notify the client that we are ready to continue registering other session protocols (bootstraps)
boolean isDoneWithRegistration = registrationWrapper.continueRegistration0();
boolean isDoneWithRegistration = this.registrationWrapper.continueRegistration0();
// tell the server we are done, and to setup crypto on it's side
if (isDoneWithRegistration) {
@ -164,8 +172,8 @@ public class RegistrationRemoteHandlerClientUDP extends RegistrationRemoteHandle
// if we get here, there was an error!
logger.error("Error registering UDP with remote server!");
shutdown(registrationWrapper, channel);
this.logger.error("Error registering UDP with remote server!");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
}

View File

@ -7,6 +7,8 @@ import io.netty.util.ReferenceCountUtil;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.slf4j.Logger;
import dorkbox.network.connection.RegistrationWrapper;
import dorkbox.network.connection.registration.MetaChannel;
import dorkbox.network.connection.registration.Registration;
@ -28,7 +30,7 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
*/
@Override
protected void initChannel(Channel channel) {
logger.trace("Channel registered: {}", channel.getClass().getSimpleName());
this.logger.trace("Channel registered: {}", channel.getClass().getSimpleName());
// TCP & UDT
@ -41,7 +43,8 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
*/
@Override
public void channelActive(ChannelHandlerContext context) throws Exception {
if (logger.isDebugEnabled()) {
Logger logger2 = this.logger;
if (logger2.isDebugEnabled()) {
super.channelActive(context);
}
@ -57,7 +60,7 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
InetAddress udtRemoteServer = udtRemoteAddress.getAddress();
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
Entries<MetaChannel> entries = channelMap.entries();
while (entries.hasNext()) {
MetaChannel metaChannel = entries.next().value;
@ -74,14 +77,16 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
}
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (!success) {
throw new RuntimeException("UDT cannot connect to a remote server before TCP is established!");
}
logger.trace("Start new UDT Connection. Sending request to server");
if (logger2.isTraceEnabled()) {
logger2.trace("Start new UDT Connection. Sending request to server");
}
Registration registration = new Registration();
// client start the handshake with a registration packet
@ -100,10 +105,10 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
MetaChannel metaChannel = null;
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
metaChannel = channelMap.get(channel.hashCode());
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (metaChannel != null) {
@ -115,8 +120,8 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
OptimizeUtils optimizeUtils = OptimizeUtils.get();
if (!optimizeUtils.canReadInt(payload)) {
logger.error("Invalid decryption of connection ID. Aborting.");
shutdown(registrationWrapper, channel);
this.logger.error("Invalid decryption of connection ID. Aborting.");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
return;
@ -126,17 +131,17 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
MetaChannel metaChannel2 = null;
try {
IntMap<MetaChannel> channelMap = registrationWrapper.getAndLockChannelMap();
IntMap<MetaChannel> channelMap = this.registrationWrapper.getAndLockChannelMap();
metaChannel2 = channelMap.get(connectionID);
} finally {
registrationWrapper.releaseChannelMap();
this.registrationWrapper.releaseChannelMap();
}
if (metaChannel2 != null) {
// hooray! we are successful
// notify the client that we are ready to continue registering other session protocols (bootstraps)
boolean isDoneWithRegistration = registrationWrapper.continueRegistration0();
boolean isDoneWithRegistration = this.registrationWrapper.continueRegistration0();
// tell the server we are done, and to setup crypto on it's side
if (isDoneWithRegistration) {
@ -159,8 +164,8 @@ public class RegistrationRemoteHandlerClientUDT extends RegistrationRemoteHandle
// if we get here, there was an error!
logger.error("Error registering UDT with remote server!");
shutdown(registrationWrapper, channel);
this.logger.error("Error registering UDT with remote server!");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
}
}

View File

@ -18,6 +18,7 @@ import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.spec.ECParameterSpec;
import org.bouncycastle.util.Arrays;
import org.slf4j.Logger;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
@ -128,6 +129,7 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
}
// make sure this connection was properly registered in the map. (IT SHOULD BE)
Logger logger2 = this.logger;
if (metaChannel != null) {
metaChannel.updateTcpRoundTripTime();
SecureRandom secureRandom = this.registrationWrapper.getSecureRandom();
@ -136,7 +138,7 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
if (metaChannel.connectionID == null) {
// whoa! Didn't send valid public key info!
if (registration.publicKey == null) {
this.logger.error("Null ECC public key during client handshake. This shouldn't happen!");
logger2.error("Null ECC public key during client handshake. This shouldn't happen!");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
@ -151,7 +153,9 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
if (!valid) {
//whoa! abort since something messed up! (log happens inside of validate method)
this.logger.info("Invalid ECC public key for IP {} during handshake with client. Toggling extra flag in channel to indicate this.", tcpRemoteClient.getAddress().getHostAddress());
if (this.logger.isInfoEnabled()) {
logger2.info("Invalid ECC public key for IP {} during handshake with client. Toggling extra flag in channel to indicate this.", tcpRemoteClient.getAddress().getHostAddress());
}
metaChannel.changedRemoteKey = true;
}
@ -224,7 +228,9 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
channel.write(register);
this.logger.trace("Assigning new random connection ID for TCP and performing ECDH.");
if (logger2.isTraceEnabled()) {
logger2.trace("Assigning new random connection ID for TCP and performing ECDH.");
}
// re-sync the TCP delta round trip time
metaChannel.updateTcpRoundTripTime();
@ -244,7 +250,7 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
byte[] payload = Crypto.AES.decrypt(getAesEngine(), metaChannel.aesKey, metaChannel.aesIV, registration.payload);
if (payload.length == 0) {
this.logger.error("Invalid decryption of payload. Aborting.");
logger2.error("Invalid decryption of payload. Aborting.");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
@ -254,7 +260,7 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
ECPublicKeyParameters ecdhPubKey = EccPublicKeySerializer.read(new Input(payload));
if (ecdhPubKey == null) {
this.logger.error("Invalid decode of ecdh public key. Aborting.");
logger2.error("Invalid decode of ecdh public key. Aborting.");
shutdown(this.registrationWrapper, channel);
ReferenceCountUtil.release(message);
@ -302,7 +308,10 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
channel.eventLoop().schedule(new Runnable() {
@Override
public void run() {
RegistrationRemoteHandlerServerTCP.this.logger.trace("Notify Connection");
Logger logger2 = RegistrationRemoteHandlerServerTCP.this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("Notify Connection");
}
notifyConnection(chan2);
}}, metaChannel.getNanoSecBetweenTCP() * 2, TimeUnit.NANOSECONDS);
}
@ -313,7 +322,7 @@ public class RegistrationRemoteHandlerServerTCP extends RegistrationRemoteHandle
}
}
// this should NEVER happen!
this.logger.error("Error registering TCP channel! MetaChannel is null!");
logger2.error("Error registering TCP channel! MetaChannel is null!");
}
shutdown(this.registrationWrapper, channel);

View File

@ -197,7 +197,10 @@ public class RmiBridge {
}
instances.remove(this);
this.logger.trace("Closed ObjectSpace.");
Logger logger2 = this.logger;
if (logger2.isTraceEnabled()) {
logger2.trace("Closed ObjectSpace.");
}
}
/**

View File

@ -13,6 +13,7 @@ import java.util.zip.Deflater;
import java.util.zip.Inflater;
import org.bouncycastle.crypto.engines.AESFastEngine;
import org.slf4j.Logger;
import com.esotericsoftware.kryo.ClassResolver;
import com.esotericsoftware.kryo.Kryo;
@ -352,6 +353,7 @@ public class KryoSerializationManager implements SerializationManager {
private final void write0(Connection connection, ByteBuf buffer, Object message, boolean doCrypto) {
nextAvailable:
while (true) {
Logger logger2 = logger;
for (int i=0;i<this.numberOfInstances;i++) {
boolean wasAvailable = this.kryoLocks[i].compareAndSet(false, true);
@ -414,7 +416,9 @@ public class KryoSerializationManager implements SerializationManager {
// AES CRYPTO
if (doCrypto) {
logger.trace("Encrypting data with - AES {}", connection);
if (logger2.isTraceEnabled()) {
logger2.trace("Encrypting data with - AES {}", connection);
}
length = Crypto.AES.encrypt(this.aesEngines[i], connection.getCryptoParameters(),
bufferWithData, bufferTempData, length);
@ -446,7 +450,10 @@ public class KryoSerializationManager implements SerializationManager {
break nextAvailable;
}
}
logger.trace("Waiting for another WRITE Kryo. It was full.");
if (logger2.isTraceEnabled()) {
logger2.trace("Waiting for another WRITE Kryo. It was full.");
}
// none were available. wait a small amount of time and try again
synchronized (this.instanceWaitLock) {
@ -512,6 +519,7 @@ public class KryoSerializationManager implements SerializationManager {
@SuppressWarnings("unchecked")
private final Object read0(Connection connection, ByteBuf buffer, int length, boolean doCrypto) {
while (true) {
Logger logger2 = logger;
for (int i=0;i<this.numberOfInstances;i++) {
boolean wasAvailable = this.kryoLocks[i].compareAndSet(false, true);
@ -541,7 +549,9 @@ public class KryoSerializationManager implements SerializationManager {
throw new NetException("Unable to perform crypto when data does not to use crypto!");
}
logger.trace("Decrypting data with - AES " + connection);
if (logger2.isTraceEnabled()) {
logger2.trace("Decrypting data with - AES " + connection);
}
Crypto.AES.decrypt(this.aesEngines[i], connection.getCryptoParameters(),
bufferWithData, bufferTempData, length);
@ -604,7 +614,9 @@ public class KryoSerializationManager implements SerializationManager {
}
}
logger.trace("Waiting for another READ Kryo. It was full.");
if (logger2.isTraceEnabled()) {
logger2.trace("Waiting for another READ Kryo. It was full.");
}
// none were available. wait a small amount of time and try again
synchronized (this.instanceWaitLock) {