http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index 51b633f..2613929 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -1243,8 +1243,7 @@ public class ConfigurationImpl implements Configuration, Serializable { public boolean isCheckForLiveServer() { if (haPolicyConfiguration instanceof ReplicaPolicyConfiguration) { return ((ReplicatedPolicyConfiguration) haPolicyConfiguration).isCheckForLiveServer(); - } - else { + } else { return false; } } @@ -1500,14 +1499,12 @@ public class ConfigurationImpl implements Configuration, Serializable { if (acceptorConfigs == null) { if (other.acceptorConfigs != null) return false; - } - else if (!acceptorConfigs.equals(other.acceptorConfigs)) + } else if (!acceptorConfigs.equals(other.acceptorConfigs)) return false; if (addressesSettings == null) { if (other.addressesSettings != null) return false; - } - else if (!addressesSettings.equals(other.addressesSettings)) + } else if (!addressesSettings.equals(other.addressesSettings)) return false; if (asyncConnectionExecutionEnabled != other.asyncConnectionExecutionEnabled) return false; @@ -1515,52 +1512,44 @@ public class ConfigurationImpl implements Configuration, Serializable { if (bindingsDirectory == null) { if (other.bindingsDirectory != null) return false; - } - else if (!bindingsDirectory.equals(other.bindingsDirectory)) + } else if (!bindingsDirectory.equals(other.bindingsDirectory)) return false; if (bridgeConfigurations == null) { if (other.bridgeConfigurations != null) return false; - } - else if (!bridgeConfigurations.equals(other.bridgeConfigurations)) + } else if (!bridgeConfigurations.equals(other.bridgeConfigurations)) return false; if (broadcastGroupConfigurations == null) { if (other.broadcastGroupConfigurations != null) return false; - } - else if (!broadcastGroupConfigurations.equals(other.broadcastGroupConfigurations)) + } else if (!broadcastGroupConfigurations.equals(other.broadcastGroupConfigurations)) return false; if (clusterConfigurations == null) { if (other.clusterConfigurations != null) return false; - } - else if (!clusterConfigurations.equals(other.clusterConfigurations)) + } else if (!clusterConfigurations.equals(other.clusterConfigurations)) return false; if (clusterPassword == null) { if (other.clusterPassword != null) return false; - } - else if (!clusterPassword.equals(other.clusterPassword)) + } else if (!clusterPassword.equals(other.clusterPassword)) return false; if (clusterUser == null) { if (other.clusterUser != null) return false; - } - else if (!clusterUser.equals(other.clusterUser)) + } else if (!clusterUser.equals(other.clusterUser)) return false; if (connectionTTLOverride != other.connectionTTLOverride) return false; if (connectorConfigs == null) { if (other.connectorConfigs != null) return false; - } - else if (!connectorConfigs.equals(other.connectorConfigs)) + } else if (!connectorConfigs.equals(other.connectorConfigs)) return false; if (connectorServiceConfigurations == null) { if (other.connectorServiceConfigurations != null) return false; - } - else if (!connectorServiceConfigurations.equals(other.connectorServiceConfigurations)) + } else if (!connectorServiceConfigurations.equals(other.connectorServiceConfigurations)) return false; if (createBindingsDir != other.createBindingsDir) return false; @@ -1569,14 +1558,12 @@ public class ConfigurationImpl implements Configuration, Serializable { if (discoveryGroupConfigurations == null) { if (other.discoveryGroupConfigurations != null) return false; - } - else if (!discoveryGroupConfigurations.equals(other.discoveryGroupConfigurations)) + } else if (!discoveryGroupConfigurations.equals(other.discoveryGroupConfigurations)) return false; if (divertConfigurations == null) { if (other.divertConfigurations != null) return false; - } - else if (!divertConfigurations.equals(other.divertConfigurations)) + } else if (!divertConfigurations.equals(other.divertConfigurations)) return false; if (failoverOnServerShutdown != other.failoverOnServerShutdown) return false; @@ -1585,22 +1572,19 @@ public class ConfigurationImpl implements Configuration, Serializable { if (groupingHandlerConfiguration == null) { if (other.groupingHandlerConfiguration != null) return false; - } - else if (!groupingHandlerConfiguration.equals(other.groupingHandlerConfiguration)) + } else if (!groupingHandlerConfiguration.equals(other.groupingHandlerConfiguration)) return false; if (idCacheSize != other.idCacheSize) return false; if (incomingInterceptorClassNames == null) { if (other.incomingInterceptorClassNames != null) return false; - } - else if (!incomingInterceptorClassNames.equals(other.incomingInterceptorClassNames)) + } else if (!incomingInterceptorClassNames.equals(other.incomingInterceptorClassNames)) return false; if (jmxDomain == null) { if (other.jmxDomain != null) return false; - } - else if (!jmxDomain.equals(other.jmxDomain)) + } else if (!jmxDomain.equals(other.jmxDomain)) return false; if (jmxManagementEnabled != other.jmxManagementEnabled) return false; @@ -1619,8 +1603,7 @@ public class ConfigurationImpl implements Configuration, Serializable { if (journalDirectory == null) { if (other.journalDirectory != null) return false; - } - else if (!journalDirectory.equals(other.journalDirectory)) + } else if (!journalDirectory.equals(other.journalDirectory)) return false; if (journalFileSize != other.journalFileSize) return false; @@ -1641,22 +1624,19 @@ public class ConfigurationImpl implements Configuration, Serializable { if (largeMessagesDirectory == null) { if (other.largeMessagesDirectory != null) return false; - } - else if (!largeMessagesDirectory.equals(other.largeMessagesDirectory)) + } else if (!largeMessagesDirectory.equals(other.largeMessagesDirectory)) return false; if (logJournalWriteRate != other.logJournalWriteRate) return false; if (managementAddress == null) { if (other.managementAddress != null) return false; - } - else if (!managementAddress.equals(other.managementAddress)) + } else if (!managementAddress.equals(other.managementAddress)) return false; if (managementNotificationAddress == null) { if (other.managementNotificationAddress != null) return false; - } - else if (!managementNotificationAddress.equals(other.managementNotificationAddress)) + } else if (!managementNotificationAddress.equals(other.managementNotificationAddress)) return false; if (maskPassword != other.maskPassword) return false; @@ -1679,21 +1659,18 @@ public class ConfigurationImpl implements Configuration, Serializable { if (name == null) { if (other.name != null) return false; - } - else if (!name.equals(other.name)) + } else if (!name.equals(other.name)) return false; if (outgoingInterceptorClassNames == null) { if (other.outgoingInterceptorClassNames != null) return false; - } - else if (!outgoingInterceptorClassNames.equals(other.outgoingInterceptorClassNames)) + } else if (!outgoingInterceptorClassNames.equals(other.outgoingInterceptorClassNames)) return false; if (pagingDirectory == null) { if (other.pagingDirectory != null) return false; - } - else if (!pagingDirectory.equals(other.pagingDirectory)) + } else if (!pagingDirectory.equals(other.pagingDirectory)) return false; if (persistDeliveryCountBeforeDelivery != other.persistDeliveryCountBeforeDelivery) return false; @@ -1704,8 +1681,7 @@ public class ConfigurationImpl implements Configuration, Serializable { if (queueConfigurations == null) { if (other.queueConfigurations != null) return false; - } - else if (!queueConfigurations.equals(other.queueConfigurations)) + } else if (!queueConfigurations.equals(other.queueConfigurations)) return false; if (runSyncSpeedTest != other.runSyncSpeedTest) return false; @@ -1720,8 +1696,7 @@ public class ConfigurationImpl implements Configuration, Serializable { if (securitySettings == null) { if (other.securitySettings != null) return false; - } - else if (!securitySettings.equals(other.securitySettings)) + } else if (!securitySettings.equals(other.securitySettings)) return false; if (serverDumpInterval != other.serverDumpInterval) return false; @@ -1829,8 +1804,7 @@ public class ConfigurationImpl implements Configuration, Serializable { private File subFolder(String subFolder) { try { return getBrokerInstance().toPath().resolve(subFolder).toFile(); - } - catch (Exception e) { + } catch (Exception e) { throw new RuntimeException(e); } }
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileConfiguration.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileConfiguration.java index b0c7440..16e9745 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileConfiguration.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.core.config.impl; +import javax.management.MBeanServer; import java.net.URL; import java.util.Map; @@ -26,8 +27,6 @@ import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; import org.w3c.dom.Element; -import javax.management.MBeanServer; - /** * A {@code FileConfiguration} reads configuration values from a file. */ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java index 8fb14c0..d778aa5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/FileSecurityConfiguration.java @@ -69,8 +69,7 @@ public class FileSecurityConfiguration extends SecurityConfiguration { if (maskPassword) { if (passwordCodec != null) { codec = PasswordMaskingUtil.getDefaultCodec(); - } - else { + } else { codec = PasswordMaskingUtil.getCodec(passwordCodec); } } @@ -105,8 +104,7 @@ public class FileSecurityConfiguration extends SecurityConfiguration { String roles = roleProps.getProperty(username); if (roles == null) { ActiveMQServerLogger.LOGGER.cannotFindRoleForUser(username); - } - else { + } else { String[] split = roles.split(","); for (String role : split) { addRole(username, role.trim()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java index 76b814d..3a94067 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java @@ -18,16 +18,15 @@ package org.apache.activemq.artemis.core.config.impl; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.Configuration; - -import org.apache.activemq.artemis.core.security.User; -import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; -import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.core.security.User; +import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; +import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; + public class SecurityConfiguration extends Configuration { /** @@ -110,6 +109,6 @@ public class SecurityConfiguration extends Configuration { map.put(InVMLoginModule.CONFIG_PROP_NAME, this); AppConfigurationEntry appConfigurationEntry = new AppConfigurationEntry(name, AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, map); - return new AppConfigurationEntry[] {appConfigurationEntry}; + return new AppConfigurationEntry[]{appConfigurationEntry}; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java index ae8c5f3..98bced3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java @@ -55,8 +55,7 @@ public final class Validators { Number val = (Number) value; if (val.doubleValue() > 0) { // OK - } - else { + } else { throw ActiveMQMessageBundle.BUNDLE.greaterThanZero(name, val); } } @@ -78,8 +77,7 @@ public final class Validators { Number val = (Number) value; if (val.doubleValue() >= 0) { // OK - } - else { + } else { throw ActiveMQMessageBundle.BUNDLE.greaterThanZero(name, val); } } @@ -91,8 +89,7 @@ public final class Validators { Number val = (Number) value; if (val.doubleValue() == -1 || val.doubleValue() > 0) { // OK - } - else { + } else { throw ActiveMQMessageBundle.BUNDLE.greaterThanMinusOne(name, val); } } @@ -104,8 +101,7 @@ public final class Validators { Number val = (Number) value; if (val.doubleValue() == -1 || val.doubleValue() >= 0) { // OK - } - else { + } else { throw ActiveMQMessageBundle.BUNDLE.greaterThanZeroOrMinusOne(name, val); } } @@ -117,8 +113,7 @@ public final class Validators { Number val = (Number) value; if (val.intValue() >= Thread.MIN_PRIORITY && val.intValue() <= Thread.MAX_PRIORITY) { // OK - } - else { + } else { throw ActiveMQMessageBundle.BUNDLE.mustbeBetween(name, Thread.MIN_PRIORITY, Thread.MAX_PRIORITY, value); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/Deployable.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/Deployable.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/Deployable.java index 20a0c2e..6ee59d6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/Deployable.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/Deployable.java @@ -16,14 +16,14 @@ */ package org.apache.activemq.artemis.core.deployers; -import org.apache.activemq.artemis.core.server.ActiveMQComponent; -import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; -import org.w3c.dom.Element; - import javax.management.MBeanServer; import java.net.URL; import java.util.Map; +import org.apache.activemq.artemis.core.server.ActiveMQComponent; +import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; +import org.w3c.dom.Element; + /** * A Deployable is an object that can be configured via an xml configuration element in the main configuration file "broker.xml" * It holds all the information needed by the FileDeploymentManager to parse the configuration and build the component http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/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 f700e32..d90c343 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 @@ -303,8 +303,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (maskText) { SensitiveDataCodec<String> codec = PasswordMaskingUtil.getCodec(config.getPasswordCodec()); config.setClusterPassword(codec.decode(passwordText)); - } - else { + } else { config.setClusterPassword(passwordText); } } @@ -469,8 +468,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (s.equals(JournalType.NIO.toString())) { config.setJournalType(JournalType.NIO); - } - else if (s.equals(JournalType.ASYNCIO.toString())) { + } else if (s.equals(JournalType.ASYNCIO.toString())) { // https://jira.jboss.org/jira/browse/HORNETQ-295 // We do the check here to see if AIO is supported so we can use the correct defaults and/or use // correct settings in xml @@ -479,8 +477,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (supportsAIO) { config.setJournalType(JournalType.ASYNCIO); - } - else { + } else { if (validateAIO) { ActiveMQServerLogger.LOGGER.AIONotFound(); } @@ -505,8 +502,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { config.setJournalBufferTimeout_AIO(journalBufferTimeout); config.setJournalBufferSize_AIO(journalBufferSize); config.setJournalMaxIO_AIO(journalMaxIO); - } - else { + } else { config.setJournalBufferTimeout_NIO(journalBufferTimeout); config.setJournalBufferSize_NIO(journalBufferSize); config.setJournalMaxIO_NIO(journalMaxIO); @@ -664,35 +660,25 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { for (String role : roles) { if (SEND_NAME.equals(type)) { send.add(role.trim()); - } - else if (CONSUME_NAME.equals(type)) { + } else if (CONSUME_NAME.equals(type)) { consume.add(role.trim()); - } - else if (CREATEDURABLEQUEUE_NAME.equals(type)) { + } else if (CREATEDURABLEQUEUE_NAME.equals(type)) { createDurableQueue.add(role.trim()); - } - else if (DELETEDURABLEQUEUE_NAME.equals(type)) { + } else if (DELETEDURABLEQUEUE_NAME.equals(type)) { deleteDurableQueue.add(role.trim()); - } - else if (CREATE_NON_DURABLE_QUEUE_NAME.equals(type)) { + } else if (CREATE_NON_DURABLE_QUEUE_NAME.equals(type)) { createNonDurableQueue.add(role.trim()); - } - else if (DELETE_NON_DURABLE_QUEUE_NAME.equals(type)) { + } else if (DELETE_NON_DURABLE_QUEUE_NAME.equals(type)) { deleteNonDurableQueue.add(role.trim()); - } - else if (CREATETEMPQUEUE_NAME.equals(type)) { + } else if (CREATETEMPQUEUE_NAME.equals(type)) { createNonDurableQueue.add(role.trim()); - } - else if (DELETETEMPQUEUE_NAME.equals(type)) { + } else if (DELETETEMPQUEUE_NAME.equals(type)) { deleteNonDurableQueue.add(role.trim()); - } - else if (MANAGE_NAME.equals(type)) { + } else if (MANAGE_NAME.equals(type)) { manageRoles.add(role.trim()); - } - else if (BROWSE_NAME.equals(type)) { + } else if (BROWSE_NAME.equals(type)) { browseRoles.add(role.trim()); - } - else { + } else { ActiveMQServerLogger.LOGGER.rolePermissionConfigurationError(type); } if (!allRoles.contains(role.trim())) { @@ -753,84 +739,62 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (DEAD_LETTER_ADDRESS_NODE_NAME.equalsIgnoreCase(name)) { SimpleString queueName = new SimpleString(getTrimmedTextContent(child)); addressSettings.setDeadLetterAddress(queueName); - } - else if (EXPIRY_ADDRESS_NODE_NAME.equalsIgnoreCase(name)) { + } else if (EXPIRY_ADDRESS_NODE_NAME.equalsIgnoreCase(name)) { SimpleString queueName = new SimpleString(getTrimmedTextContent(child)); addressSettings.setExpiryAddress(queueName); - } - else if (EXPIRY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { + } else if (EXPIRY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setExpiryDelay(XMLUtil.parseLong(child)); - } - else if (REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { + } else if (REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setRedeliveryDelay(XMLUtil.parseLong(child)); - } - else if (REDELIVERY_DELAY_MULTIPLIER_NODE_NAME.equalsIgnoreCase(name)) { + } else if (REDELIVERY_DELAY_MULTIPLIER_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setRedeliveryMultiplier(XMLUtil.parseDouble(child)); - } - else if (MAX_REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { + } else if (MAX_REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setMaxRedeliveryDelay(XMLUtil.parseLong(child)); - } - else if (MAX_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) { + } else if (MAX_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setMaxSizeBytes(XMLUtil.parseLong(child)); - } - else if (PAGE_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) { + } else if (PAGE_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setPageSizeBytes(XMLUtil.parseLong(child)); - } - else if (PAGE_MAX_CACHE_SIZE_NODE_NAME.equalsIgnoreCase(name)) { + } else if (PAGE_MAX_CACHE_SIZE_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setPageCacheMaxSize(XMLUtil.parseInt(child)); - } - else if (MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(name)) { + } else if (MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setMessageCounterHistoryDayLimit(XMLUtil.parseInt(child)); - } - else if (ADDRESS_FULL_MESSAGE_POLICY_NODE_NAME.equalsIgnoreCase(name)) { + } else if (ADDRESS_FULL_MESSAGE_POLICY_NODE_NAME.equalsIgnoreCase(name)) { String value = getTrimmedTextContent(child); Validators.ADDRESS_FULL_MESSAGE_POLICY_TYPE.validate(ADDRESS_FULL_MESSAGE_POLICY_NODE_NAME, value); AddressFullMessagePolicy policy = Enum.valueOf(AddressFullMessagePolicy.class, value); addressSettings.setAddressFullMessagePolicy(policy); - } - else if (LVQ_NODE_NAME.equalsIgnoreCase(name)) { + } else if (LVQ_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setLastValueQueue(XMLUtil.parseBoolean(child)); - } - else if (MAX_DELIVERY_ATTEMPTS.equalsIgnoreCase(name)) { + } else if (MAX_DELIVERY_ATTEMPTS.equalsIgnoreCase(name)) { addressSettings.setMaxDeliveryAttempts(XMLUtil.parseInt(child)); - } - else if (REDISTRIBUTION_DELAY_NODE_NAME.equalsIgnoreCase(name)) { + } else if (REDISTRIBUTION_DELAY_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setRedistributionDelay(XMLUtil.parseLong(child)); - } - else if (SEND_TO_DLA_ON_NO_ROUTE.equalsIgnoreCase(name)) { + } else if (SEND_TO_DLA_ON_NO_ROUTE.equalsIgnoreCase(name)) { addressSettings.setSendToDLAOnNoRoute(XMLUtil.parseBoolean(child)); - } - else if (SLOW_CONSUMER_THRESHOLD_NODE_NAME.equalsIgnoreCase(name)) { + } else if (SLOW_CONSUMER_THRESHOLD_NODE_NAME.equalsIgnoreCase(name)) { long slowConsumerThreshold = XMLUtil.parseLong(child); Validators.MINUS_ONE_OR_GT_ZERO.validate(SLOW_CONSUMER_THRESHOLD_NODE_NAME, slowConsumerThreshold); addressSettings.setSlowConsumerThreshold(slowConsumerThreshold); - } - else if (SLOW_CONSUMER_CHECK_PERIOD_NODE_NAME.equalsIgnoreCase(name)) { + } else if (SLOW_CONSUMER_CHECK_PERIOD_NODE_NAME.equalsIgnoreCase(name)) { long slowConsumerCheckPeriod = XMLUtil.parseLong(child); Validators.GT_ZERO.validate(SLOW_CONSUMER_CHECK_PERIOD_NODE_NAME, slowConsumerCheckPeriod); addressSettings.setSlowConsumerCheckPeriod(slowConsumerCheckPeriod); - } - else if (SLOW_CONSUMER_POLICY_NODE_NAME.equalsIgnoreCase(name)) { + } else if (SLOW_CONSUMER_POLICY_NODE_NAME.equalsIgnoreCase(name)) { String value = getTrimmedTextContent(child); Validators.SLOW_CONSUMER_POLICY_TYPE.validate(SLOW_CONSUMER_POLICY_NODE_NAME, value); SlowConsumerPolicy policy = Enum.valueOf(SlowConsumerPolicy.class, value); addressSettings.setSlowConsumerPolicy(policy); - } - else if (AUTO_CREATE_JMS_QUEUES.equalsIgnoreCase(name)) { + } else if (AUTO_CREATE_JMS_QUEUES.equalsIgnoreCase(name)) { addressSettings.setAutoCreateJmsQueues(XMLUtil.parseBoolean(child)); - } - else if (AUTO_DELETE_JMS_QUEUES.equalsIgnoreCase(name)) { + } else if (AUTO_DELETE_JMS_QUEUES.equalsIgnoreCase(name)) { addressSettings.setAutoDeleteJmsQueues(XMLUtil.parseBoolean(child)); - } - else if (AUTO_CREATE_JMS_TOPICS.equalsIgnoreCase(name)) { + } else if (AUTO_CREATE_JMS_TOPICS.equalsIgnoreCase(name)) { addressSettings.setAutoCreateJmsTopics(XMLUtil.parseBoolean(child)); - } - else if (AUTO_DELETE_JMS_TOPICS.equalsIgnoreCase(name)) { + } else if (AUTO_DELETE_JMS_TOPICS.equalsIgnoreCase(name)) { addressSettings.setAutoDeleteJmsTopics(XMLUtil.parseBoolean(child)); - } - else if (MANAGEMENT_BROWSE_PAGE_SIZE.equalsIgnoreCase(name)) { + } else if (MANAGEMENT_BROWSE_PAGE_SIZE.equalsIgnoreCase(name)) { addressSettings.setManagementBrowsePageSize(XMLUtil.parseInt(child)); } } @@ -853,8 +817,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { final String name = child.getNodeName(); if (MAX_CONNECTIONS_NODE_NAME.equalsIgnoreCase(name)) { resourceLimitSettings.setMaxConnections(XMLUtil.parseInt(child)); - } - else if (MAX_QUEUES_NODE_NAME.equalsIgnoreCase(name)) { + } else if (MAX_QUEUES_NODE_NAME.equalsIgnoreCase(name)) { resourceLimitSettings.setMaxQueues(XMLUtil.parseInt(child)); } } @@ -874,11 +837,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (child.getNodeName().equals("address")) { address = getTrimmedTextContent(child); - } - else if (child.getNodeName().equals("filter")) { + } else if (child.getNodeName().equals("filter")) { filterString = getAttributeValue(child, "string"); - } - else if (child.getNodeName().equals("durable")) { + } else if (child.getNodeName().equals("durable")) { durable = XMLUtil.parseBoolean(child); } } @@ -969,8 +930,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { Element storeNode = (Element) storeNodeList.item(0); if (storeNode.getTagName().equals("database-store")) { mainConfig.setStoreConfiguration(createDatabaseStoreConfig(storeNode)); - } - else if (storeNode.getTagName().equals("file-store")) { + } else if (storeNode.getTagName().equals("file-store")) { mainConfig.setStoreConfiguration(createFileStoreConfig(storeNode)); } } @@ -998,8 +958,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { Element colocatedNode = (Element) colocatedNodeList.item(0); mainConfig.setHAPolicyConfiguration(createColocatedHaPolicy(colocatedNode, true)); } - } - else if (haNode.getTagName().equals("shared-store")) { + } else if (haNode.getTagName().equals("shared-store")) { NodeList masterNodeList = e.getElementsByTagName("master"); if (masterNodeList.getLength() > 0) { Element masterNode = (Element) masterNodeList.item(0); @@ -1015,8 +974,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { Element colocatedNode = (Element) colocatedNodeList.item(0); mainConfig.setHAPolicyConfiguration(createColocatedHaPolicy(colocatedNode, false)); } - } - else if (haNode.getTagName().equals("live-only")) { + } else if (haNode.getTagName().equals("live-only")) { NodeList noneNodeList = e.getElementsByTagName("live-only"); Element noneNode = (Element) noneNodeList.item(0); mainConfig.setHAPolicyConfiguration(createLiveOnlyHaPolicy(noneNode)); @@ -1228,8 +1186,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (jgroupsFile != null) { endpointFactory = new JGroupsFileBroadcastEndpointFactory().setFile(jgroupsFile).setChannelName(jgroupsChannel); - } - else { + } else { endpointFactory = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindAddress(localAddress).setLocalBindPort(localBindPort); } @@ -1261,8 +1218,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { BroadcastEndpointFactory endpointFactory; if (jgroupsFile != null) { endpointFactory = new JGroupsFileBroadcastEndpointFactory().setFile(jgroupsFile).setChannelName(jgroupsChannel); - } - else { + } else { endpointFactory = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindAddress(localBindAddress).setLocalBindPort(localBindPort); } @@ -1272,16 +1228,15 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { ActiveMQServerLogger.LOGGER.discoveryGroupAlreadyDeployed(name); return; - } - else { + } else { mainConfig.getDiscoveryGroupConfigurations().put(name, config); } } - private void parseClusterConnectionConfigurationURI(final Element e, final Configuration mainConfig) throws Exception { + private void parseClusterConnectionConfigurationURI(final Element e, + final Configuration mainConfig) throws Exception { String name = e.getAttribute("name"); - String uri = e.getAttribute("address"); ClusterConnectionConfiguration config = mainConfig.addClusterConfiguration(name, uri); @@ -1304,12 +1259,10 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { boolean forwardWhenNoConsumers = getBoolean(e, "forward-when-no-consumers", ActiveMQDefaultConfiguration.isDefaultClusterForwardWhenNoConsumers()); if (forwardWhenNoConsumers) { messageLoadBalancingType = MessageLoadBalancingType.STRICT; - } - else { + } else { messageLoadBalancingType = MessageLoadBalancingType.ON_DEMAND; } - } - else { + } else { messageLoadBalancingType = Enum.valueOf(MessageLoadBalancingType.class, getString(e, "message-load-balancing", ActiveMQDefaultConfiguration.getDefaultClusterMessageLoadBalancingType(), Validators.MESSAGE_LOAD_BALANCING_TYPE)); } @@ -1359,8 +1312,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (child.getNodeName().equals("discovery-group-ref")) { discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue(); - } - else if (child.getNodeName().equals("static-connectors")) { + } else if (child.getNodeName().equals("static-connectors")) { Node attr = child.getAttributes().getNamedItem("allow-direct-connections-only"); if (attr != null) { allowDirectConnectionsOnly = "true".equalsIgnoreCase(attr.getNodeValue()) || allowDirectConnectionsOnly; @@ -1369,33 +1321,11 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } } - ClusterConnectionConfiguration config = new ClusterConnectionConfiguration() - .setName(name) - .setAddress(address) - .setConnectorName(connectorName) - .setMinLargeMessageSize(minLargeMessageSize) - .setClientFailureCheckPeriod(clientFailureCheckPeriod) - .setConnectionTTL(connectionTTL) - .setRetryInterval(retryInterval) - .setRetryIntervalMultiplier(retryIntervalMultiplier) - .setMaxRetryInterval(maxRetryInterval) - .setInitialConnectAttempts(initialConnectAttempts) - .setReconnectAttempts(reconnectAttempts) - .setCallTimeout(callTimeout) - .setCallFailoverTimeout(callFailoverTimeout) - .setDuplicateDetection(duplicateDetection) - .setMessageLoadBalancingType(messageLoadBalancingType) - .setMaxHops(maxHops) - .setConfirmationWindowSize(confirmationWindowSize) - .setProducerWindowSize(producerWindowSize) - .setAllowDirectConnectionsOnly(allowDirectConnectionsOnly) - .setClusterNotificationInterval(clusterNotificationInterval) - .setClusterNotificationAttempts(clusterNotificationAttempts); + ClusterConnectionConfiguration config = new ClusterConnectionConfiguration().setName(name).setAddress(address).setConnectorName(connectorName).setMinLargeMessageSize(minLargeMessageSize).setClientFailureCheckPeriod(clientFailureCheckPeriod).setConnectionTTL(connectionTTL).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setMaxRetryInterval(maxRetryInterval).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setCallTimeout(callTimeout).setCallFailoverTimeout(callFailoverTimeout).setDuplicateDetection(duplicateDetection).setMessageLoadBalancingType(messageLoadBalancingType).setMaxHops(maxHops).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setAllowDirectConnectionsOnly(allowDirectConnectionsOnly).setClusterNotificationInterval(clusterNotificationInterval).setClusterNotificationAttempts(clusterNotificationAttempts); if (discoveryGroupName == null) { config.setStaticConnectors(staticConnectorNames); - } - else { + } else { config.setDiscoveryGroupName(discoveryGroupName); } @@ -1464,8 +1394,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { codec = PasswordMaskingUtil.getCodec(mainConfig.getPasswordCodec()); password = codec.decode(password); } - } - else { + } else { password = ActiveMQDefaultConfiguration.getDefaultClusterPassword(); } @@ -1484,41 +1413,18 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { if (child.getNodeName().equals("filter")) { filterString = child.getAttributes().getNamedItem("string").getNodeValue(); - } - else if (child.getNodeName().equals("discovery-group-ref")) { + } else if (child.getNodeName().equals("discovery-group-ref")) { discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue(); - } - else if (child.getNodeName().equals("static-connectors")) { + } else if (child.getNodeName().equals("static-connectors")) { getStaticConnectors(staticConnectorNames, child); } } - BridgeConfiguration config = new BridgeConfiguration() - .setName(name) - .setQueueName(queueName) - .setForwardingAddress(forwardingAddress) - .setFilterString(filterString) - .setTransformerClassName(transformerClassName) - .setMinLargeMessageSize(minLargeMessageSize) - .setClientFailureCheckPeriod(clientFailureCheckPeriod) - .setConnectionTTL(connectionTTL) - .setRetryInterval(retryInterval) - .setMaxRetryInterval(maxRetryInterval) - .setRetryIntervalMultiplier(retryIntervalMultiplier) - .setInitialConnectAttempts(initialConnectAttempts) - .setReconnectAttempts(reconnectAttempts) - .setReconnectAttemptsOnSameNode(reconnectAttemptsSameNode) - .setUseDuplicateDetection(useDuplicateDetection) - .setConfirmationWindowSize(confirmationWindowSize) - .setProducerWindowSize(producerWindowSize) - .setHA(ha) - .setUser(user) - .setPassword(password); + BridgeConfiguration config = new BridgeConfiguration().setName(name).setQueueName(queueName).setForwardingAddress(forwardingAddress).setFilterString(filterString).setTransformerClassName(transformerClassName).setMinLargeMessageSize(minLargeMessageSize).setClientFailureCheckPeriod(clientFailureCheckPeriod).setConnectionTTL(connectionTTL).setRetryInterval(retryInterval).setMaxRetryInterval(maxRetryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setReconnectAttemptsOnSameNode(reconnectAttemptsSameNode).setUseDuplicateDetection(useDuplicateDetection).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setHA(ha).setUser(user).setPassword(password); if (!staticConnectorNames.isEmpty()) { config.setStaticConnectors(staticConnectorNames); - } - else { + } else { config.setDiscoveryGroupName(discoveryGroupName); } @@ -1594,4 +1500,4 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { return new ConnectorServiceConfiguration().setFactoryClassName(clazz).setParams(params).setName(name); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java index f807a18..b014b86 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java @@ -17,16 +17,16 @@ package org.apache.activemq.artemis.core.filter.impl; import org.apache.activemq.artemis.api.core.ActiveMQException; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; -import org.apache.activemq.artemis.selector.filter.BooleanExpression; -import org.apache.activemq.artemis.selector.filter.FilterException; -import org.apache.activemq.artemis.selector.filter.Filterable; -import org.apache.activemq.artemis.selector.impl.SelectorParser; import org.apache.activemq.artemis.api.core.FilterConstants; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; +import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.ServerMessage; +import org.apache.activemq.artemis.selector.filter.BooleanExpression; +import org.apache.activemq.artemis.selector.filter.FilterException; +import org.apache.activemq.artemis.selector.filter.Filterable; +import org.apache.activemq.artemis.selector.impl.SelectorParser; /** * This class implements an ActiveMQ Artemis filter @@ -76,8 +76,7 @@ public class FilterImpl implements Filter { BooleanExpression booleanExpression; try { booleanExpression = SelectorParser.parse(filterStr.toString()); - } - catch (Throwable e) { + } catch (Throwable e) { ActiveMQServerLogger.LOGGER.invalidFilter(filterStr); if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { ActiveMQServerLogger.LOGGER.debug("Invalid filter", e); @@ -106,8 +105,7 @@ public class FilterImpl implements Filter { try { boolean result = booleanExpression.matches(new FilterableServerMessage(message)); return result; - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.invalidFilter(sfilterString); if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { ActiveMQServerLogger.LOGGER.debug("Invalid filter", e); @@ -136,8 +134,7 @@ public class FilterImpl implements Filter { if (sfilterString == null) { if (other.sfilterString != null) return false; - } - else if (!sfilterString.equals(other.sfilterString)) + } else if (!sfilterString.equals(other.sfilterString)) return false; return true; } @@ -153,26 +150,19 @@ public class FilterImpl implements Filter { if (FilterConstants.ACTIVEMQ_USERID.equals(fieldName)) { // It's the stringified (hex) representation of a user id that can be used in a selector expression return new SimpleString("ID:" + msg.getUserID()); - } - else if (FilterConstants.ACTIVEMQ_PRIORITY.equals(fieldName)) { + } else if (FilterConstants.ACTIVEMQ_PRIORITY.equals(fieldName)) { return Integer.valueOf(msg.getPriority()); - } - else if (FilterConstants.ACTIVEMQ_TIMESTAMP.equals(fieldName)) { + } else if (FilterConstants.ACTIVEMQ_TIMESTAMP.equals(fieldName)) { return msg.getTimestamp(); - } - else if (FilterConstants.ACTIVEMQ_DURABLE.equals(fieldName)) { + } else if (FilterConstants.ACTIVEMQ_DURABLE.equals(fieldName)) { return msg.isDurable() ? FilterConstants.DURABLE : FilterConstants.NON_DURABLE; - } - else if (FilterConstants.ACTIVEMQ_EXPIRATION.equals(fieldName)) { + } else if (FilterConstants.ACTIVEMQ_EXPIRATION.equals(fieldName)) { return msg.getExpiration(); - } - else if (FilterConstants.ACTIVEMQ_SIZE.equals(fieldName)) { + } else if (FilterConstants.ACTIVEMQ_SIZE.equals(fieldName)) { return msg.getEncodeSize(); - } - else if (FilterConstants.ACTIVEMQ_ADDRESS.equals(fieldName)) { + } else if (FilterConstants.ACTIVEMQ_ADDRESS.equals(fieldName)) { return msg.getAddress(); - } - else { + } else { return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java index 1a83081..021a6ce 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java @@ -60,8 +60,7 @@ public abstract class AbstractControl extends StandardMBean { try { storageManager.waitOnOperations(); storageManager.clearContext(); - } - catch (Exception e) { + } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java index ae7660b..ce511ef 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AcceptorControlImpl.java @@ -16,10 +16,9 @@ */ package org.apache.activemq.artemis.core.management.impl; -import java.util.Map; - import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; +import java.util.Map; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.AcceptorControl; @@ -55,8 +54,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { return configuration.getFactoryClassName(); - } - finally { + } finally { blockOnIO(); } } @@ -66,8 +64,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { return configuration.getName(); - } - finally { + } finally { blockOnIO(); } } @@ -77,8 +74,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { return configuration.getParams(); - } - finally { + } finally { blockOnIO(); } } @@ -88,8 +84,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { acceptor.reload(); - } - finally { + } finally { blockOnIO(); } } @@ -99,8 +94,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { return acceptor.isStarted(); - } - finally { + } finally { blockOnIO(); } } @@ -110,8 +104,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { acceptor.start(); - } - finally { + } finally { blockOnIO(); } } @@ -121,8 +114,7 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont clearIO(); try { acceptor.stop(); - } - finally { + } finally { blockOnIO(); } }
