From 9a1a2b13692b8737b82a62725e8dc60fefb5a32d Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 9 Sep 2019 11:11:21 +0100 Subject: [PATCH] ARTEMIS-2477 - create a less verbose and more descriptive warning when the native Netty jars are not present on the classpath https://issues.apache.org/jira/browse/ARTEMIS-2477 --- .../artemis/core/client/ActiveMQClientLogger.java | 9 +++++++++ .../core/remoting/impl/netty/CheckDependencies.java | 6 ++++++ 2 files changed, 15 insertions(+) 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 6156c15877..700b863827 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 @@ -410,6 +410,15 @@ public interface ActiveMQClientLogger extends BasicLogger { format = Message.Format.MESSAGE_FORMAT) void confirmationNotSet(); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 212075, value = "KQueue is not available, please add to the classpath or configure useKQueue=false to remove this warning", + format = Message.Format.MESSAGE_FORMAT) + void unableToCheckKQueueAvailabilityNoClass(); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 212076, value = "Epoll is not available, please add to the classpath or configure useEpoll=false to remove this warning", + format = Message.Format.MESSAGE_FORMAT) + void unableToCheckEpollAvailabilitynoClass(); @LogMessage(level = Logger.Level.ERROR) @Message(id = 214000, value = "Failed to call onMessage", format = Message.Format.MESSAGE_FORMAT) 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 fb7da4b3ff..c29b17c70e 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 @@ -34,6 +34,9 @@ public class CheckDependencies { public static final boolean isEpollAvailable() { try { return Env.isLinuxOs() && Epoll.isAvailable(); + } catch (NoClassDefFoundError noClassDefFoundError) { + ActiveMQClientLogger.LOGGER.unableToCheckEpollAvailabilitynoClass(); + return false; } catch (Throwable e) { ActiveMQClientLogger.LOGGER.unableToCheckEpollAvailability(e); return false; @@ -43,6 +46,9 @@ public class CheckDependencies { public static final boolean isKQueueAvailable() { try { return Env.isMacOs() && KQueue.isAvailable(); + } catch (NoClassDefFoundError noClassDefFoundError) { + ActiveMQClientLogger.LOGGER.unableToCheckKQueueAvailabilityNoClass(); + return false; } catch (Throwable e) { ActiveMQClientLogger.LOGGER.unableToCheckKQueueAvailability(e); return false;