activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: [ARTEMIS-147] Add WARN log when setting connection-ttl OR connection-ttl-override equal to check-period.
Date Wed, 05 Aug 2015 12:59:53 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 38fb9300c -> 72b7f8271


[ARTEMIS-147] Add WARN log when setting connection-ttl OR connection-ttl-override equal to
check-period.

Now works when ARTEMIS is deployed in an application server as well as standalone.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/699a7ca7
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/699a7ca7
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/699a7ca7

Branch: refs/heads/master
Commit: 699a7ca7efd34a8f6995269a3402c98af30b889e
Parents: 38fb930
Author: Ryan Emerson <remerson@redhat.com>
Authored: Tue Aug 4 16:09:08 2015 +0100
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Aug 5 08:59:40 2015 -0400

----------------------------------------------------------------------
 .../artemis/core/config/ConfigurationUtils.java | 26 ++++++++++++++++++++
 .../deployers/impl/FileConfigurationParser.java | 14 -----------
 .../core/server/ActiveMQServerLogger.java       | 10 ++++----
 .../core/server/impl/ActiveMQServerImpl.java    |  5 ++++
 4 files changed, 36 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/699a7ca7/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java
index eb17193..c83ca9f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ConfigurationUtils.java
@@ -24,6 +24,7 @@ import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
 import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
 import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
 import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
+import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
 import org.apache.activemq.artemis.core.server.cluster.ha.BackupPolicy;
 import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy;
 import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy;
@@ -143,4 +144,29 @@ public final class ConfigurationUtils
       }
       return null;
    }
+
+   // A method to check the passed Configuration object and warn users if semantically unwise
parameters are present
+   public static void validateConfiguration(Configuration configuration)
+   {
+      // Warn if connection-ttl-override/connection-ttl == check-period
+      compareTTLWithCheckPeriod(configuration);
+   }
+
+   private static void compareTTLWithCheckPeriod(Configuration configuration)
+   {
+      for (ClusterConnectionConfiguration c : configuration.getClusterConfigurations())
+         compareTTLWithCheckPeriod(c.getName(), c.getConnectionTTL(), configuration.getConnectionTTLOverride(),
c.getClientFailureCheckPeriod());
+
+      for (BridgeConfiguration c : configuration.getBridgeConfigurations())
+         compareTTLWithCheckPeriod(c.getName(), c.getConnectionTTL(), configuration.getConnectionTTLOverride(),
c.getClientFailureCheckPeriod());
+   }
+
+   private static void compareTTLWithCheckPeriod(String name, long connectionTTL, long connectionTTLOverride,
long checkPeriod)
+   {
+      if (connectionTTLOverride == checkPeriod)
+         ActiveMQServerLogger.LOGGER.connectionTTLEqualsCheckPeriod(name, "connection-ttl-override",
"check-period");
+
+      if (connectionTTL == checkPeriod)
+         ActiveMQServerLogger.LOGGER.connectionTTLEqualsCheckPeriod(name, "connection-ttl",
"check-period");
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/699a7ca7/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
----------------------------------------------------------------------
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 c1b767a..708b710 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,9 +1525,6 @@ 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)
@@ -1689,8 +1686,6 @@ 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)
@@ -1811,13 +1806,4 @@ 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

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/699a7ca7/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
----------------------------------------------------------------------
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 11e6f61..69b34e8 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
@@ -1168,11 +1168,11 @@ public interface ActiveMQServerLogger extends BasicLogger
 
    @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);
+      value = "{0}: <{1}> should not be set to the same value as <{2}>.  " +
+         "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 connectionName, String ttl, String checkPeriod);
 
    @LogMessage(level = Logger.Level.ERROR)
    @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT)

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/699a7ca7/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 9d7e95b..e33286c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -316,6 +316,11 @@ public class ActiveMQServerImpl implements ActiveMQServer
       {
          configuration = new ConfigurationImpl();
       }
+      else
+      {
+         ConfigurationUtils.validateConfiguration(configuration);
+      }
+
       if (mbeanServer == null)
       {
          // Just use JVM mbean server


Mime
View raw message