Add WARN log when setting connection-ttl OR connection-ttl-override equal to check-period.

This commit is contained in:
Ryan Emerson 2015-06-26 16:29:47 +01:00
parent a94cfd5416
commit 6b13b3bf97
2 changed files with 24 additions and 1 deletions

View File

@ -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() ClusterConnectionConfiguration config = new ClusterConnectionConfiguration()
.setName(name) .setName(name)
.setAddress(address) .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() BridgeConfiguration config = new BridgeConfiguration()
.setName(name) .setName(name)
.setQueueName(queueName) .setQueueName(queueName)
@ -1805,4 +1811,13 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
.setParams(params) .setParams(params)
.setName(name); .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");
}
} }

View File

@ -1166,6 +1166,14 @@ public interface ActiveMQServerLogger extends BasicLogger
format = Message.Format.MESSAGE_FORMAT) format = Message.Format.MESSAGE_FORMAT)
void backupActivationTimeout(); 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) @LogMessage(level = Logger.Level.ERROR)
@Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT) @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT)
void initializationError(@Cause Throwable e); void initializationError(@Cause Throwable e);