From 8c25daee985d18e9ceb48fc50a4bd8b558075e87 Mon Sep 17 00:00:00 2001 From: Howard Gao Date: Tue, 7 Jul 2020 17:11:35 +0800 Subject: [PATCH] ARTEMIS-2835 Porting HORNETQ-1575 and HORNETQ-1578 2 of 2) - Porting of HORNETQ-1578 Exceptions are swallowed, making it hard to diagnose issues --- .../activemq/artemis/core/server/ActiveMQServerLogger.java | 4 ++++ .../core/server/impl/SharedNothingLiveActivation.java | 5 +++++ 2 files changed, 9 insertions(+) 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 3ae605eff8..ff4c72842f 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 @@ -2100,4 +2100,8 @@ public interface ActiveMQServerLogger extends BasicLogger { @LogMessage(level = Logger.Level.ERROR) @Message(id = 224104, value = "Error starting the Acceptor {0} {1}", format = Message.Format.MESSAGE_FORMAT) void errorStartingAcceptor(String name, Object configuration); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 224105, value = "Connecting to cluster failed") + void failedConnectingToCluster(@Cause Exception e); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java index 660d442a1c..5e3f225b06 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQAlreadyReplicatingException; import org.apache.activemq.artemis.api.core.ActiveMQDisconnectedException; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.Pair; @@ -330,6 +331,10 @@ public class SharedNothingLiveActivation extends LiveActivation { // Just try connecting listener.latch.await(5, TimeUnit.SECONDS); } catch (Exception notConnected) { + if (!(notConnected instanceof ActiveMQException) || ActiveMQExceptionType.INTERNAL_ERROR.equals(((ActiveMQException) notConnected).getType())) { + // report all exceptions that aren't ActiveMQException and all INTERNAL_ERRORs + ActiveMQServerLogger.LOGGER.failedConnectingToCluster(notConnected); + } return false; }