NO-JIRA Fixed log level test on NettyConnection

This commit is contained in:
Francesco Nigro 2017-04-06 18:06:46 +02:00 committed by Clebert Suconic
parent 7d9ae1a83e
commit 41a069a346
1 changed files with 5 additions and 7 deletions

View File

@ -295,7 +295,7 @@ public class NettyConnection implements Connection {
public final boolean blockUntilWritable(final int requiredCapacity, final long timeout, final TimeUnit timeUnit) { public final boolean blockUntilWritable(final int requiredCapacity, final long timeout, final TimeUnit timeUnit) {
final boolean isAllowedToBlock = isAllowedToBlock(); final boolean isAllowedToBlock = isAllowedToBlock();
if (!isAllowedToBlock) { if (!isAllowedToBlock) {
if (!logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Calling blockUntilWritable using a thread where it's not allowed"); logger.debug("Calling blockUntilWritable using a thread where it's not allowed");
} }
return canWrite(requiredCapacity); return canWrite(requiredCapacity);
@ -347,14 +347,12 @@ public class NettyConnection implements Connection {
final boolean batched, final boolean batched,
final ChannelFutureListener futureListener) { final ChannelFutureListener futureListener) {
final int readableBytes = buffer.readableBytes(); final int readableBytes = buffer.readableBytes();
if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) { if (logger.isDebugEnabled()) {
final int remainingBytes = this.writeBufferHighWaterMark - readableBytes; final int remainingBytes = this.writeBufferHighWaterMark - readableBytes;
if (remainingBytes < 0) { if (remainingBytes < 0) {
if (logger.isDebugEnabled()) { logger.debug("a write request is exceeding by " + (-remainingBytes) +
logger.debug("a write request is exceeding by " + (-remainingBytes) + " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark +
" bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark + " ] : consider to set it at least of " + readableBytes + " bytes");
" ] : consider to set it at least of " + readableBytes + " bytes");
}
} }
} }
//no need to lock because the Netty's channel is thread-safe //no need to lock because the Netty's channel is thread-safe