ARTEMIS-994 Tidy up on epoll

- improved logging
- renamed properties and tidy up on configurations


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

Branch: refs/heads/master
Commit: 096556f346fdaab17b2e829801f7218ccc3dac1b
Parents: a610748
Author: Clebert Suconic <[email protected]>
Authored: Thu Mar 23 16:32:42 2017 -0400
Committer: Justin Bertram <[email protected]>
Committed: Thu Mar 23 18:16:48 2017 -0500

----------------------------------------------------------------------
 .../artemis/cli/commands/etc/amqp-acceptor.txt  |  2 +-
 .../artemis/cli/commands/etc/broker.xml         |  5 +-
 .../cli/commands/etc/hornetq-acceptor.txt       |  2 +-
 .../artemis/cli/commands/etc/mqtt-acceptor.txt  |  2 +-
 .../artemis/cli/commands/etc/stomp-acceptor.txt |  2 +-
 .../remoting/impl/netty/NettyConnector.java     | 68 +++++++-------------
 .../remoting/impl/netty/TransportConstants.java | 26 +++++---
 .../core/remoting/impl/netty/NettyAcceptor.java | 68 +++++++++-----------
 .../core/server/ActiveMQServerLogger.java       |  4 +-
 9 files changed, 77 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt
 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt
index 0a4b381..5b20b92 100644
--- 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt
+++ 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt
@@ -1,3 +1,3 @@
 
          <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
-         <acceptor 
name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP</acceptor>
+         <acceptor 
name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP;useEpoll=true</acceptor>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
index f1f96e7..5ca8687 100644
--- 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
+++ 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
@@ -61,9 +61,10 @@ 
${ping-config.settings}${journal-buffer.settings}${connector-config.settings}
       <global-max-size>100Mb</global-max-size>
 
       <acceptors>
-         <!-- Acceptor for every supported protocol -->
-         <acceptor 
name="artemis">tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE</acceptor>
+         <!-- useEpoll means: it will use Netty epoll if you are on a system 
(Linux) that supports it -->
 
+         <!-- Acceptor for every supported protocol -->
+         <acceptor 
name="artemis">tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true</acceptor>
 ${amqp-acceptor}${stomp-acceptor}${hornetq-acceptor}${mqtt-acceptor}
       </acceptors>
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt
 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt
index 3c0d804..da77ebe 100644
--- 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt
+++ 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt
@@ -1,3 +1,3 @@
 
          <!-- HornetQ Compatibility Acceptor.  Enables HornetQ Core and STOMP 
for legacy HornetQ clients. -->
-         <acceptor 
name="hornetq">tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP</acceptor>
+         <acceptor 
name="hornetq">tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP;useEpoll=true</acceptor>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt
 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt
index bf383f8..ceaf615 100644
--- 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt
+++ 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt
@@ -1,3 +1,3 @@
 
          <!-- MQTT Acceptor -->
-         <acceptor 
name="mqtt">tcp://${host}:${mqtt.port}?protocols=MQTT</acceptor>
+         <acceptor 
name="mqtt">tcp://${host}:${mqtt.port}?protocols=MQTT;useEpoll=true</acceptor>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt
----------------------------------------------------------------------
diff --git 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt
 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt
index 6c79165..bfe4d8b 100644
--- 
a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt
+++ 
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt
@@ -1,3 +1,3 @@
 
          <!-- STOMP Acceptor. -->
-         <acceptor 
name="stomp">tcp://${host}:${stomp.port}?protocols=STOMP</acceptor>
+         <acceptor 
name="stomp">tcp://${host}:${stomp.port}?protocols=STOMP;useEpoll=true</acceptor>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/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 cc062d3..4997e0f 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
@@ -217,15 +217,11 @@ public class NettyConnector extends AbstractConnector {
 
    private String servletPath;
 
-   private int nioRemotingThreads;
-
-   private boolean useNioGlobalWorkerPool;
-
    private boolean useEpoll;
 
-   private int epollRemotingThreads;
+   private int remotingThreads;
 
-   private boolean useEpollGlobalWorkerPool;
+   private boolean useGlobalWorkerPool;
 
    private ScheduledExecutorService scheduledThreadPool;
 
@@ -293,17 +289,14 @@ public class NettyConnector extends AbstractConnector {
 
       httpUpgradeEnabled = 
ConfigurationHelper.getBooleanProperty(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME,
 TransportConstants.DEFAULT_HTTP_UPGRADE_ENABLED, configuration);
 
-      nioRemotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.NIO_REMOTING_THREADS_PROPNAME,
 -1, configuration);
+      remotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.NIO_REMOTING_THREADS_PROPNAME,
 -1, configuration);
+      remotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.REMOTING_THREADS_PROPNAME,
 remotingThreads, configuration);
 
-      useNioGlobalWorkerPool = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME,
 TransportConstants.DEFAULT_USE_NIO_GLOBAL_WORKER_POOL, configuration);
+      useGlobalWorkerPool = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME,
 TransportConstants.DEFAULT_USE_GLOBAL_WORKER_POOL, configuration);
+      useGlobalWorkerPool = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_GLOBAL_WORKER_POOL_PROP_NAME,
 useGlobalWorkerPool, configuration);
 
       useEpoll = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_EPOLL_PROP_NAME, 
TransportConstants.DEFAULT_USE_EPOLL, configuration);
 
-      epollRemotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.EPOLL_REMOTING_THREADS_PROPNAME,
 -1, configuration);
-
-      useEpollGlobalWorkerPool = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_EPOLL_GLOBAL_WORKER_POOL_PROP_NAME,
 TransportConstants.DEFAULT_USE_EPOLL_GLOBAL_WORKER_POOL, configuration);
-
-
       useServlet = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_SERVLET_PROP_NAME,
 TransportConstants.DEFAULT_USE_SERVLET, configuration);
       host = 
ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, 
TransportConstants.DEFAULT_HOST, configuration);
       port = 
ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, 
TransportConstants.DEFAULT_PORT, configuration);
@@ -387,46 +380,31 @@ public class NettyConnector extends AbstractConnector {
          return;
       }
 
-      // Default to number of cores * 3
-      int defaultThreadsToUse = Runtime.getRuntime().availableProcessors() * 3;
-
-      if (useEpoll) {
-         if (Epoll.isAvailable()) {
-            int epollThreadsToUse;
-            if (epollRemotingThreads == -1) {
-               epollThreadsToUse = defaultThreadsToUse;
-            } else {
-               epollThreadsToUse = this.epollRemotingThreads;
-            }
-            if (useEpollGlobalWorkerPool) {
-               channelClazz = EpollSocketChannel.class;
-               group = SharedEventLoopGroup.getInstance((threadFactory -> new 
EpollEventLoopGroup(epollThreadsToUse, threadFactory)));
-            } else {
-               channelClazz = EpollSocketChannel.class;
-               group = new EpollEventLoopGroup(epollThreadsToUse);
-            }
-            logger.info("Connector using native epoll");
-
-         } else {
-            logger.warn("Connector unable to load native epoll, will continue 
and load nio");
-         }
+      if (remotingThreads == -1) {
+         // Default to number of cores * 3
+         remotingThreads = Runtime.getRuntime().availableProcessors() * 3;
       }
 
-      if (channelClazz == null || group == null) {
-         int nioThreadsToUse;
-         if (nioRemotingThreads == -1) {
-            nioThreadsToUse = defaultThreadsToUse;
+      if (useEpoll && Epoll.isAvailable()) {
+         if (useGlobalWorkerPool) {
+            group = SharedEventLoopGroup.getInstance((threadFactory -> new 
EpollEventLoopGroup(remotingThreads, threadFactory)));
          } else {
-            nioThreadsToUse = this.nioRemotingThreads;
+            group = new EpollEventLoopGroup(remotingThreads);
          }
-         if (useNioGlobalWorkerPool) {
+
+         channelClazz = EpollSocketChannel.class;
+         logger.info("Connector " + this + " using native epoll");
+      } else {
+         if (useGlobalWorkerPool) {
             channelClazz = NioSocketChannel.class;
-            group = SharedEventLoopGroup.getInstance((threadFactory -> new 
NioEventLoopGroup(nioThreadsToUse, threadFactory)));
+            group = SharedEventLoopGroup.getInstance((threadFactory -> new 
NioEventLoopGroup(remotingThreads, threadFactory)));
          } else {
             channelClazz = NioSocketChannel.class;
-            group = new NioEventLoopGroup(nioThreadsToUse);
+            group = new NioEventLoopGroup(remotingThreads);
          }
-         logger.info("Connector using nio");
+
+         channelClazz = NioSocketChannel.class;
+         logger.info("Connector + " + this + " using nio");
       }
       // if we are a servlet wrap the socketChannelFactory
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java
----------------------------------------------------------------------
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java
index 12840c1..4293000 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java
@@ -49,11 +49,15 @@ public class TransportConstants {
 
    public static final String USE_NIO_PROP_NAME = "useNio";
 
-   public static final String USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME = 
"useNioGlobalWorkerPool";
-
    public static final String USE_EPOLL_PROP_NAME = "useEpoll";
 
-   public static final String USE_EPOLL_GLOBAL_WORKER_POOL_PROP_NAME = 
"useEpollGlobalWorkerPool";
+   @Deprecated
+   /**
+    * @deprecated Use USE_GLOBAL_WORKER_POOL_PROP_NAME
+    */
+   public static final String USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME = 
"useNioGlobalWorkerPool";
+
+   public static final String USE_GLOBAL_WORKER_POOL_PROP_NAME = 
"useGlobalWorkerPool";
 
    public static final String USE_INVM_PROP_NAME = "useInvm";
 
@@ -115,9 +119,13 @@ public class TransportConstants {
 
    public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = 
"tcpReceiveBufferSize";
 
+   @Deprecated
+   /**
+    * @deprecated Use REMOTING_THREADS_PROPNAME
+    */
    public static final String NIO_REMOTING_THREADS_PROPNAME = 
"nioRemotingThreads";
 
-   public static final String EPOLL_REMOTING_THREADS_PROPNAME = 
"epollRemotingThreads";
+   public static final String REMOTING_THREADS_PROPNAME = "RemotingThreads";
 
    public static final String BATCH_DELAY = "batchDelay";
 
@@ -131,9 +139,7 @@ public class TransportConstants {
 
    public static final boolean DEFAULT_SSL_ENABLED = false;
 
-   public static final boolean DEFAULT_USE_NIO_GLOBAL_WORKER_POOL = true;
-
-   public static final boolean DEFAULT_USE_EPOLL_GLOBAL_WORKER_POOL = true;
+   public static final boolean DEFAULT_USE_GLOBAL_WORKER_POOL = true;
 
    public static final boolean DEFAULT_USE_EPOLL = true;
 
@@ -248,7 +254,7 @@ public class TransportConstants {
       
allowableAcceptorKeys.add(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME);
       
allowableAcceptorKeys.add(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME);
       
allowableAcceptorKeys.add(TransportConstants.NIO_REMOTING_THREADS_PROPNAME);
-      
allowableAcceptorKeys.add(TransportConstants.EPOLL_REMOTING_THREADS_PROPNAME);
+      allowableAcceptorKeys.add(TransportConstants.REMOTING_THREADS_PROPNAME);
       allowableAcceptorKeys.add(TransportConstants.BATCH_DELAY);
       allowableAcceptorKeys.add(TransportConstants.DIRECT_DELIVER);
       allowableAcceptorKeys.add(TransportConstants.CLUSTER_CONNECTION);
@@ -280,7 +286,7 @@ public class TransportConstants {
       allowableConnectorKeys.add(TransportConstants.USE_NIO_PROP_NAME);
       
allowableConnectorKeys.add(TransportConstants.USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME);
       allowableConnectorKeys.add(TransportConstants.USE_EPOLL_PROP_NAME);
-      
allowableConnectorKeys.add(TransportConstants.USE_EPOLL_GLOBAL_WORKER_POOL_PROP_NAME);
+      
allowableConnectorKeys.add(TransportConstants.USE_GLOBAL_WORKER_POOL_PROP_NAME);
       allowableConnectorKeys.add(TransportConstants.HOST_PROP_NAME);
       allowableConnectorKeys.add(TransportConstants.PORT_PROP_NAME);
       allowableConnectorKeys.add(TransportConstants.LOCAL_ADDRESS_PROP_NAME);
@@ -298,7 +304,7 @@ public class TransportConstants {
       
allowableConnectorKeys.add(TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME);
       
allowableConnectorKeys.add(TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME);
       
allowableConnectorKeys.add(TransportConstants.NIO_REMOTING_THREADS_PROPNAME);
-      
allowableConnectorKeys.add(TransportConstants.EPOLL_REMOTING_THREADS_PROPNAME);
+      allowableConnectorKeys.add(TransportConstants.REMOTING_THREADS_PROPNAME);
       allowableConnectorKeys.add(TransportConstants.BATCH_DELAY);
       
allowableConnectorKeys.add(ActiveMQDefaultConfiguration.getPropMaskPassword());
       
allowableConnectorKeys.add(ActiveMQDefaultConfiguration.getPropPasswordCodec());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
index 50faa46..3f60a7c 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java
@@ -89,9 +89,13 @@ import org.jboss.logging.Logger;
  */
 public class NettyAcceptor extends AbstractAcceptor {
 
+   public static String INVM_ACCEPTOR_TYPE = "IN-VM";
+   public static String NIO_ACCEPTOR_TYPE = "NIO";
+   public static String EPOLL_ACCEPTOR_TYPE = "EPOLL";
+
    static {
       // Disable default Netty leak detection if the Netty leak detection 
level system properties are not in use
-      if ( System.getProperty("io.netty.leakDetectionLevel") == null && 
System.getProperty("io.netty.leakDetection.level") == null) {
+      if (System.getProperty("io.netty.leakDetectionLevel") == null && 
System.getProperty("io.netty.leakDetection.level") == null) {
          ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);
       }
    }
@@ -157,9 +161,7 @@ public class NettyAcceptor extends AbstractAcceptor {
 
    private final int tcpReceiveBufferSize;
 
-   private final int nioRemotingThreads;
-
-   private final int epollRemotingThreads;
+   private int remotingThreads;
 
    private final ConcurrentMap<Object, NettyServerConnection> connections = 
new ConcurrentHashMap<>();
 
@@ -208,12 +210,11 @@ public class NettyAcceptor extends AbstractAcceptor {
 
       sslEnabled = 
ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME,
 TransportConstants.DEFAULT_SSL_ENABLED, configuration);
 
-      nioRemotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.NIO_REMOTING_THREADS_PROPNAME,
 -1, configuration);
+      remotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.NIO_REMOTING_THREADS_PROPNAME,
 -1, configuration);
+      remotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.REMOTING_THREADS_PROPNAME,
 remotingThreads, configuration);
 
-      epollRemotingThreads = 
ConfigurationHelper.getIntProperty(TransportConstants.EPOLL_REMOTING_THREADS_PROPNAME,
 -1, configuration);
       useEpoll = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_EPOLL_PROP_NAME, 
TransportConstants.DEFAULT_USE_EPOLL, configuration);
 
-
       backlog = 
ConfigurationHelper.getIntProperty(TransportConstants.BACKLOG_PROP_NAME, -1, 
configuration);
       useInvm = 
ConfigurationHelper.getBooleanProperty(TransportConstants.USE_INVM_PROP_NAME, 
TransportConstants.DEFAULT_USE_INVM, configuration);
 
@@ -278,51 +279,40 @@ public class NettyAcceptor extends AbstractAcceptor {
          return;
       }
 
+      String acceptorType;
+
       if (useInvm) {
+         acceptorType = INVM_ACCEPTOR_TYPE;
          channelClazz = LocalServerChannel.class;
          eventLoopGroup = new LocalEventLoopGroup();
       } else {
-         // Default to number of cores * 3
-         int defaultThreadsToUse = Runtime.getRuntime().availableProcessors() 
* 3;
-
-         if (useEpoll) {
-            if (Epoll.isAvailable()) {
-               int epollThreadsToUse;
-               if (epollRemotingThreads == -1) {
-                  epollThreadsToUse = defaultThreadsToUse;
-               } else {
-                  epollThreadsToUse = this.epollRemotingThreads;
-               }
 
-               channelClazz = EpollServerSocketChannel.class;
-               eventLoopGroup = new EpollEventLoopGroup(epollThreadsToUse, 
AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() {
-                  @Override
-                  public ActiveMQThreadFactory run() {
-                     return new 
ActiveMQThreadFactory("activemq-netty-threads", true, 
ClientSessionFactoryImpl.class.getClassLoader());
-                  }
-               }));
-               logger.info("Acceptor using native epoll");
-            } else {
-               logger.warn("Acceptor unable to load native epoll, will 
continue and load nio");
-            }
+         if (remotingThreads == -1) {
+            // Default to number of cores * 3
+            remotingThreads = Runtime.getRuntime().availableProcessors() * 3;
          }
 
-         if (channelClazz == null || eventLoopGroup == null) {
-            int nioThreadsToUse;
-            if (nioRemotingThreads == -1) {
-               nioThreadsToUse = defaultThreadsToUse;
-            } else {
-               nioThreadsToUse = nioRemotingThreads;
-            }
+         if (useEpoll && Epoll.isAvailable()) {
+            channelClazz = EpollServerSocketChannel.class;
+            eventLoopGroup = new EpollEventLoopGroup(remotingThreads, 
AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() {
+               @Override
+               public ActiveMQThreadFactory run() {
+                  return new ActiveMQThreadFactory("activemq-netty-threads", 
true, ClientSessionFactoryImpl.class.getClassLoader());
+               }
+            }));
+            acceptorType = EPOLL_ACCEPTOR_TYPE;
 
+            logger.debug("Acceptor using native epoll");
+         } else {
             channelClazz = NioServerSocketChannel.class;
-            eventLoopGroup = new NioEventLoopGroup(nioThreadsToUse, 
AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() {
+            eventLoopGroup = new NioEventLoopGroup(remotingThreads, 
AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() {
                @Override
                public ActiveMQThreadFactory run() {
                   return new ActiveMQThreadFactory("activemq-netty-threads", 
true, ClientSessionFactoryImpl.class.getClassLoader());
                }
             }));
-            logger.info("Acceptor using nio");
+            acceptorType = NIO_ACCEPTOR_TYPE;
+            logger.debug("Acceptor using nio");
          }
       }
 
@@ -384,7 +374,7 @@ public class NettyAcceptor extends AbstractAcceptor {
             batchFlusherFuture = 
scheduledThreadPool.scheduleWithFixedDelay(flusher, batchDelay, batchDelay, 
TimeUnit.MILLISECONDS);
          }
 
-         ActiveMQServerLogger.LOGGER.startedAcceptor(host, port, 
protocolsString);
+         ActiveMQServerLogger.LOGGER.startedAcceptor(acceptorType, host, port, 
protocolsString);
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/096556f3/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
----------------------------------------------------------------------
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index 9152eb5..46a07df 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -169,8 +169,8 @@ public interface ActiveMQServerLogger extends BasicLogger {
    void journalUnreferencedMessage(Long messageID);
 
    @LogMessage(level = Logger.Level.INFO)
-   @Message(id = 221020, value = "Started Acceptor at {0}:{1,number,#} for 
protocols [{2}]", format = Message.Format.MESSAGE_FORMAT)
-   void startedAcceptor(String host, Integer port, String enabledProtocols);
+   @Message(id = 221020, value = "Started {0} Acceptor at {1}:{2,number,#} for 
protocols [{3}]", format = Message.Format.MESSAGE_FORMAT)
+   void startedAcceptor(String acceptorType, String host, Integer port, String 
enabledProtocols);
 
    @LogMessage(level = Logger.Level.INFO)
    @Message(id = 221021, value = "failed to remove connection", format = 
Message.Format.MESSAGE_FORMAT)

Reply via email to