You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2019/04/11 21:38:48 UTC

[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #2616: ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable

michaelandrepearce commented on a change in pull request #2616: ARTEMIS-2301 Minor change on Epoll and kQueue.isAvailable
URL: https://github.com/apache/activemq-artemis/pull/2616#discussion_r274675886
 
 

 ##########
 File path: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/CheckDependencies.java
 ##########
 @@ -0,0 +1,52 @@
+/*
+ * 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 Epoll.isAvailable();
+      } catch (java.lang.NoClassDefFoundError e) {
+         ActiveMQClientLogger.LOGGER.unableToCheckKQueueAvailability(e);
+         return false;
+      }
+   }
+
+   public static final boolean isKQueueAvailable() {
+      try {
+         return Env.isMacOs() && KQueue.isAvailable();
 
 Review comment:
   is the Env.isMacOs() needed? as you pointed out to me. I agree i totally was wrong earlier.
    it would anyhow as raised it will just throw a NCDFE.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services