You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2018/01/09 18:27:26 UTC

[2/2] activemq-artemis git commit: ARTEMIS-1585 - Log connector details on start

ARTEMIS-1585 - Log connector details on start

Log connector details when they start. 
This is similar to that of acceptors, and helps when any issues later.

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

Branch: refs/heads/master
Commit: 9c18dd04df2e8f19f34a215a6d98561941b11708
Parents: eeb3f22
Author: Michael André Pearce <mi...@me.com>
Authored: Fri Jan 5 17:53:34 2018 +0000
Committer: Justin Bertram <jb...@apache.org>
Committed: Tue Jan 9 12:26:56 2018 -0600

----------------------------------------------------------------------
 .../artemis/core/client/ActiveMQClientLogger.java    |  8 ++++++++
 .../core/remoting/impl/netty/NettyConnector.java     | 15 ++++++++++-----
 .../core/remoting/impl/invm/InVMConnector.java       |  4 ++++
 3 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9c18dd04/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientLogger.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientLogger.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientLogger.java
index a06e221..848cfa0 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientLogger.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientLogger.java
@@ -64,6 +64,14 @@ public interface ActiveMQClientLogger extends BasicLogger {
    @Message(id = 211001, value = "session created", format = Message.Format.MESSAGE_FORMAT)
    void dumpingSessionStack(@Cause Exception e);
 
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 211002, value = "Started {0} Netty Connector version {1} to {2}:{3,number,#}", format = Message.Format.MESSAGE_FORMAT)
+   void startedNettyConnector(String connectorType, String version, String host, Integer port);
+
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 211003, value = "Started InVM Connector", format = Message.Format.MESSAGE_FORMAT)
+   void startedInVMConnector();
+
    @LogMessage(level = Logger.Level.WARN)
    @Message(id = 212000, value = "{0}", format = Message.Format.MESSAGE_FORMAT)
    void warn(String message);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9c18dd04/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
index 5d3b82d..792c8aa 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java
@@ -119,6 +119,10 @@ import static org.apache.activemq.artemis.utils.Base64.encodeBytes;
 
 public class NettyConnector extends AbstractConnector {
 
+   public static String NIO_CONNECTOR_TYPE = "NIO";
+   public static String EPOLL_CONNECTOR_TYPE = "EPOLL";
+   public static String KQUEUE_CONNECTOR_TYPE = "KQUEUE";
+
    private static final Logger logger = Logger.getLogger(NettyConnector.class);
 
    // Constants -----------------------------------------------------
@@ -423,13 +427,15 @@ public class NettyConnector extends AbstractConnector {
          remotingThreads = Runtime.getRuntime().availableProcessors() * 3;
       }
 
+      String connectorType;
+
       if (useEpoll && Epoll.isAvailable()) {
          if (useGlobalWorkerPool) {
             group = SharedEventLoopGroup.getInstance((threadFactory -> new EpollEventLoopGroup(remotingThreads, threadFactory)));
          } else {
             group = new EpollEventLoopGroup(remotingThreads);
          }
-
+         connectorType = EPOLL_CONNECTOR_TYPE;
          channelClazz = EpollSocketChannel.class;
          logger.debug("Connector " + this + " using native epoll");
       } else if (useKQueue && KQueue.isAvailable()) {
@@ -438,7 +444,7 @@ public class NettyConnector extends AbstractConnector {
          } else {
             group = new KQueueEventLoopGroup(remotingThreads);
          }
-
+         connectorType = KQUEUE_CONNECTOR_TYPE;
          channelClazz = KQueueSocketChannel.class;
          logger.debug("Connector " + this + " using native kqueue");
       } else {
@@ -449,7 +455,7 @@ public class NettyConnector extends AbstractConnector {
             channelClazz = NioSocketChannel.class;
             group = new NioEventLoopGroup(remotingThreads);
          }
-
+         connectorType = NIO_CONNECTOR_TYPE;
          channelClazz = NioSocketChannel.class;
          logger.debug("Connector + " + this + " using nio");
       }
@@ -634,8 +640,7 @@ public class NettyConnector extends AbstractConnector {
 
          batchFlusherFuture = scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, TimeUnit.MILLISECONDS);
       }
-
-      logger.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION);
+      ActiveMQClientLogger.LOGGER.startedNettyConnector(connectorType,  TransportConstants.NETTY_VERSION, host, port);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9c18dd04/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
index c84020c..e635bc4 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java
@@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
+import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
 import org.apache.activemq.artemis.core.server.ActiveMQComponent;
 import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.spi.core.remoting.AbstractConnector;
@@ -47,6 +48,8 @@ import org.jboss.logging.Logger;
 
 public class InVMConnector extends AbstractConnector {
 
+   public static String INVM_CONNECTOR_TYPE = "IN-VM";
+
    private static final Logger logger = Logger.getLogger(InVMConnector.class);
 
    public static final Map<String, Object> DEFAULT_CONFIG;
@@ -195,6 +198,7 @@ public class InVMConnector extends AbstractConnector {
    @Override
    public synchronized void start() {
       started = true;
+      ActiveMQClientLogger.LOGGER.startedInVMConnector();
    }
 
    public BufferHandler getHandler() {