You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/04/06 15:41:10 UTC

activemq-artemis git commit: ARTEMIS-1025 small tweak on logs

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 25b5ddd90 -> f88311b04


ARTEMIS-1025 small tweak on logs


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/f88311b0
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/f88311b0
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/f88311b0

Branch: refs/heads/master
Commit: f88311b04b0c7f5ee83c989835dc5b4465f9ad0e
Parents: 25b5ddd
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Apr 6 11:37:28 2017 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 6 11:40:10 2017 -0400

----------------------------------------------------------------------
 .../core/remoting/impl/netty/NettyConnection.java   | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f88311b0/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
index d8b2315..e8941af 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
@@ -42,9 +42,12 @@ import org.apache.activemq.artemis.spi.core.remoting.BaseConnectionLifeCycleList
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
 import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.IPV6Util;
+import org.jboss.logging.Logger;
 
 public class NettyConnection implements Connection {
 
+   private static final Logger logger = Logger.getLogger(NettyConnection.class);
+
    private static final int DEFAULT_BATCH_BYTES = Integer.getInteger("io.netty.batch.bytes", 8192);
    private static final int DEFAULT_WAIT_MILLIS = 10_000;
 
@@ -254,7 +257,8 @@ public class NettyConnection implements Connection {
          return new ChannelBufferWrapper(channel.alloc().directBuffer(size), true);
       } catch (OutOfMemoryError oom) {
          final long totalPendingWriteBytes = batchBufferSize(this.channel, this.writeBufferHighWaterMark);
-         ActiveMQClientLogger.LOGGER.warn("Trying to allocate " + size + " bytes, System is throwing OutOfMemoryError on NettyConnection " + this + ", there are currently " + "pendingWrites: [NETTY] -> " + totalPendingWriteBytes + "[EVENT LOOP] -> " + pendingWritesOnEventLoopView.get() + " causes: " + oom.getMessage(), oom);
+         // I'm not using the ActiveMQLogger framework here, as I wanted the class name to be very specific here
+         logger.warn("Trying to allocate " + size + " bytes, System is throwing OutOfMemoryError on NettyConnection " + this + ", there are currently " + "pendingWrites: [NETTY] -> " + totalPendingWriteBytes + "[EVENT LOOP] -> " + pendingWritesOnEventLoopView.get() + " causes: " + oom.getMessage(), oom);
          throw oom;
       }
    }
@@ -291,8 +295,8 @@ public class NettyConnection implements Connection {
    public final boolean blockUntilWritable(final int requiredCapacity, final long timeout, final TimeUnit timeUnit) {
       final boolean isAllowedToBlock = isAllowedToBlock();
       if (!isAllowedToBlock) {
-         if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) {
-            ActiveMQClientLogger.LOGGER.debug("Calling blockUntilWritable using a thread where it's not allowed");
+         if (!logger.isDebugEnabled()) {
+            logger.debug("Calling blockUntilWritable using a thread where it's not allowed");
          }
          return canWrite(requiredCapacity);
       } else {
@@ -346,7 +350,11 @@ public class NettyConnection implements Connection {
       if (ActiveMQClientLogger.LOGGER.isDebugEnabled()) {
          final int remainingBytes = this.writeBufferHighWaterMark - readableBytes;
          if (remainingBytes < 0) {
-            ActiveMQClientLogger.LOGGER.debug("a write request is exceeding by " + (-remainingBytes) + " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark + " ] : consider to set it at least of " + readableBytes + " bytes");
+            if (logger.isDebugEnabled()) {
+               logger.debug("a write request is exceeding by " + (-remainingBytes) +
+                               " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark +
+                               " ] : consider to set it at least of " + readableBytes + " bytes");
+            }
          }
       }
       //no need to lock because the Netty's channel is thread-safe