From 6b13b3bf9745cde4c3c50339a33aa02ea69a4dab Mon Sep 17 00:00:00 2001 From: Ryan Emerson Date: Fri, 26 Jun 2015 16:29:47 +0100 Subject: [PATCH] Add WARN log when setting connection-ttl OR connection-ttl-override equal to check-period. --- .../deployers/impl/FileConfigurationParser.java | 17 ++++++++++++++++- .../core/server/ActiveMQServerLogger.java | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java index 3d68b19e07..8efeabbdf4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java @@ -1525,6 +1525,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil } } + // Warn if connection-ttl-override/connection-ttl == check-period + compareTTLWithCheckPeriod(mainConfig, connectionTTL, clientFailureCheckPeriod); + ClusterConnectionConfiguration config = new ClusterConnectionConfiguration() .setName(name) .setAddress(address) @@ -1686,6 +1689,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil } } + // Warn if connection-ttl-override/connection-ttl == check-period + compareTTLWithCheckPeriod(mainConfig, connectionTTL, clientFailureCheckPeriod); + BridgeConfiguration config = new BridgeConfiguration() .setName(name) .setQueueName(queueName) @@ -1805,4 +1811,13 @@ public final class FileConfigurationParser extends XMLConfigurationUtil .setParams(params) .setName(name); } -} + + private void compareTTLWithCheckPeriod(final Configuration config, final long connectionTTL, final long checkPeriod) + { + if (config.getConnectionTTLOverride() == checkPeriod) + ActiveMQServerLogger.LOGGER.connectionTTLEqualsCheckPeriod("connection-ttl-override", "check-period"); + + if (connectionTTL == checkPeriod) + ActiveMQServerLogger.LOGGER.connectionTTLEqualsCheckPeriod("connection-ttl", "check-period"); + } +} \ No newline at end of file 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 231b94c680..b136990600 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 @@ -1166,6 +1166,14 @@ public interface ActiveMQServerLogger extends BasicLogger format = Message.Format.MESSAGE_FORMAT) void backupActivationTimeout(); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222202, + value = "<{0}> should not be set to the same value as <{1}>. " + + "If a system is under high load, or there is a minor network delay, " + + "there is a high probability of a cluster split/failure due to connection timeout.", + format = Message.Format.MESSAGE_FORMAT) + void connectionTTLEqualsCheckPeriod(String ttl, String checkPeriod); + @LogMessage(level = Logger.Level.ERROR) @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT) void initializationError(@Cause Throwable e);