[activemq-artemis] branch master updated: ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable

2019-04-12 Thread clebertsuconic
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
 new e7bdc58  ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable
 new 8c2d891  This closes #2617
e7bdc58 is described below

commit e7bdc58c492a18b14ebba71ea8ad223fce975260
Author: Michael André Pearce 
AuthorDate: Fri Apr 12 11:51:59 2019 +0100

ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable

small fix to logging
---
 .../activemq/artemis/core/remoting/impl/netty/CheckDependencies.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
index 987cac9..fb7da4b 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
@@ -35,7 +35,7 @@ public class CheckDependencies {
   try {
  return Env.isLinuxOs() && Epoll.isAvailable();
   } catch (Throwable e)  {
- ActiveMQClientLogger.LOGGER.unableToCheckKQueueAvailability(e);
+ ActiveMQClientLogger.LOGGER.unableToCheckEpollAvailability(e);
  return false;
   }
}



[activemq-artemis] branch master updated: ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable

2019-04-12 Thread nigrofranz
This is an automated email from the ASF dual-hosted git repository.

nigrofranz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
 new cf2540e  ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable
 new 4b29936  This closes #2616
cf2540e is described below

commit cf2540ebb197ba5802ffafa1d32ab0216e1090a3
Author: Clebert Suconic 
AuthorDate: Thu Apr 11 10:22:39 2019 -0400

ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable

just checking for NoClassDefFound and return false
---
 .../org/apache/activemq/artemis/utils/Env.java | 12 +
 .../remoting/impl/netty/CheckDependencies.java | 51 ++
 .../core/remoting/impl/netty/NettyConnector.java   |  6 +--
 .../core/remoting/impl/netty/NettyAcceptor.java|  6 +--
 4 files changed, 67 insertions(+), 8 deletions(-)

diff --git 
a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java 
b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java
index ed403f8..a10424b 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/Env.java
@@ -59,6 +59,10 @@ public final class Env {
 */
private static boolean testEnv = false;
 
+   private static final String OS = 
System.getProperty("os.name").toLowerCase();
+   private static final boolean IS_LINUX = OS.startsWith("linux");
+   private static final boolean IS_MAC = OS.startsWith("mac");
+
private Env() {
 
}
@@ -79,4 +83,12 @@ public final class Env {
   Env.testEnv = testEnv;
}
 
+   public static boolean isLinuxOs() {
+  return IS_LINUX == true;
+   }
+
+   public static boolean isMacOs() {
+  return IS_MAC == true;
+   }
+
 }
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
new file mode 100644
index 000..987cac9
--- /dev/null
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.core.remoting.impl.netty;
+
+import io.netty.channel.epoll.Epoll;
+import io.netty.channel.kqueue.KQueue;
+import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
+import org.apache.activemq.artemis.utils.Env;
+import org.jboss.logging.Logger;
+
+/**
+ * This class will check for Epoll or KQueue is available, and return false in 
case of NoClassDefFoundError
+ * it could be improved to check for other cases eventually.
+ */
+public class CheckDependencies {
+
+   private static final Logger logger = 
Logger.getLogger(CheckDependencies.class);
+
+   public static final boolean isEpollAvailable() {
+  try {
+ return Env.isLinuxOs() && Epoll.isAvailable();
+  } catch (Throwable e)  {
+ ActiveMQClientLogger.LOGGER.unableToCheckKQueueAvailability(e);
+ return false;
+  }
+   }
+
+   public static final boolean isKQueueAvailable() {
+  try {
+ return Env.isMacOs() && KQueue.isAvailable();
+  } catch (Throwable e) {
+ ActiveMQClientLogger.LOGGER.unableToCheckKQueueAvailability(e);
+ return false;
+  }
+   }
+}
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 fa0682e..29cc9cd 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
@@ -65,12 +65,10 @@ import io.netty.channel.ChannelPromise;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.SimpleChannelInboundHandler;
 import io.netty.channel.WriteBufferWaterMark;
-import