http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemConfigImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemConfigImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemConfigImpl.java index 6b313e2..a89d390 100755 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemConfigImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemConfigImpl.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.admin.internal; @@ -35,19 +33,15 @@ import java.util.*; import static org.apache.geode.distributed.ConfigurationProperties.*; /** - * An implementation of the configuration object for an - * <code>AdminDistributedSystem</code>. After a config has been used - * to create an <code>AdminDistributedSystem</code> most of the - * configuration attributes cannot be changed. However, some - * operations (such as getting information about GemFire managers and - * distribution locators) are "passed through" to the - * <code>AdminDistributedSystem</code> associated with this - * configuration object. + * An implementation of the configuration object for an <code>AdminDistributedSystem</code>. After a + * config has been used to create an <code>AdminDistributedSystem</code> most of the configuration + * attributes cannot be changed. However, some operations (such as getting information about GemFire + * managers and distribution locators) are "passed through" to the + * <code>AdminDistributedSystem</code> associated with this configuration object. * * @since GemFire 3.5 */ -public class DistributedSystemConfigImpl - implements DistributedSystemConfig { +public class DistributedSystemConfigImpl implements DistributedSystemConfig { private static final Logger logger = LogService.getLogger(); @@ -86,8 +80,7 @@ public class DistributedSystemConfigImpl private Set cacheServerConfigs = new HashSet(); /** - * Configs for the managed distribution locators in the distributed - * system + * Configs for the managed distribution locators in the distributed system */ private Set locatorConfigs = new HashSet(); @@ -97,10 +90,10 @@ public class DistributedSystemConfigImpl private String systemName = DEFAULT_NAME; /** - * The admin distributed system object that is configured by this - * config object. + * The admin distributed system object that is configured by this config object. * - * @since GemFire 4.0 */ + * @since GemFire 4.0 + */ private AdminDistributedSystemImpl system; /** @@ -108,27 +101,21 @@ public class DistributedSystemConfigImpl */ private InternalLogWriter logWriter; - /////////////////////// Static Methods /////////////////////// + /////////////////////// Static Methods /////////////////////// /** - * Filters out all properties that are unique to the admin - * <code>DistributedSystemConfig</code> that are not present in the - * internal <code>DistributionConfig</code>. + * Filters out all properties that are unique to the admin <code>DistributedSystemConfig</code> + * that are not present in the internal <code>DistributionConfig</code>. * * @since GemFire 4.0 */ - private static Properties - filterOutAdminProperties(Properties props) { + private static Properties filterOutAdminProperties(Properties props) { Properties props2 = new Properties(); - for (Enumeration names = props.propertyNames(); - names.hasMoreElements(); ) { + for (Enumeration names = props.propertyNames(); names.hasMoreElements();) { String name = (String) names.nextElement(); - if (!(ENTITY_CONFIG_XML_FILE_NAME.equals(name) || - REFRESH_INTERVAL_NAME.equals(name) || - REMOTE_COMMAND_NAME.equals(name) - ) - ) { + if (!(ENTITY_CONFIG_XML_FILE_NAME.equals(name) || REFRESH_INTERVAL_NAME.equals(name) + || REMOTE_COMMAND_NAME.equals(name))) { String value = props.getProperty(name); if ((name != null) && (value != null)) { props2.setProperty(name, value); @@ -139,24 +126,23 @@ public class DistributedSystemConfigImpl return props2; } - //////////////////////// Constructors //////////////////////// + //////////////////////// Constructors //////////////////////// /** - * Creates a new <code>DistributedSystemConfigImpl</code> based on - * the configuration stored in a <code>DistributedSystem</code>'s - * <code>DistributionConfig</code>. + * Creates a new <code>DistributedSystemConfigImpl</code> based on the configuration stored in a + * <code>DistributedSystem</code>'s <code>DistributionConfig</code>. */ - public DistributedSystemConfigImpl(DistributionConfig distConfig, - String remoteCommand) { + public DistributedSystemConfigImpl(DistributionConfig distConfig, String remoteCommand) { if (distConfig == null) { - throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_DISTRIBUTIONCONFIG_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.DistributedSystemConfigImpl_DISTRIBUTIONCONFIG_MUST_NOT_BE_NULL + .toLocalizedString()); } this.mcastAddress = InetAddressUtil.toString(distConfig.getMcastAddress()); this.mcastPort = distConfig.getMcastPort(); this.locators = distConfig.getLocators(); - this.membershipPortRange = - getMembershipPortRangeString(distConfig.getMembershipPortRange()); + this.membershipPortRange = getMembershipPortRangeString(distConfig.getMembershipPortRange()); this.systemName = distConfig.getName(); @@ -166,8 +152,7 @@ public class DistributedSystemConfigImpl this.sslAuthenticationRequired = distConfig.getClusterSSLRequireAuthentication(); this.logFile = distConfig.getLogFile().getPath(); - this.logLevel = - LogWriterImpl.levelToString(distConfig.getLogLevel()); + this.logLevel = LogWriterImpl.levelToString(distConfig.getLogLevel()); this.logDiskSpaceLimit = distConfig.getLogDiskSpaceLimit(); this.logFileSizeLimit = distConfig.getLogFileSizeLimit(); @@ -194,76 +179,70 @@ public class DistributedSystemConfigImpl } /** - * Creates a new <code>DistributedSystemConifgImpl</code> whose - * configuration is specified by the given <code>Properties</code> - * object. + * Creates a new <code>DistributedSystemConifgImpl</code> whose configuration is specified by the + * given <code>Properties</code> object. */ protected DistributedSystemConfigImpl(Properties props) { this(props, false); } /** - * Creates a new <code>DistributedSystemConifgImpl</code> whose configuration - * is specified by the given <code>Properties</code> object. + * Creates a new <code>DistributedSystemConifgImpl</code> whose configuration is specified by the + * given <code>Properties</code> object. + * + * @param props The configuration properties specified by the caller + * @param ignoreGemFirePropsFile whether to skip loading distributed system properties from + * gemfire.properties file * - * @param props - * The configuration properties specified by the caller - * @param ignoreGemFirePropsFile - * whether to skip loading distributed system properties from - * gemfire.properties file - * * @since GemFire 6.5 */ - protected DistributedSystemConfigImpl(Properties props, - boolean ignoreGemFirePropsFile) { - this(new DistributionConfigImpl( - filterOutAdminProperties(props), ignoreGemFirePropsFile), + protected DistributedSystemConfigImpl(Properties props, boolean ignoreGemFirePropsFile) { + this(new DistributionConfigImpl(filterOutAdminProperties(props), ignoreGemFirePropsFile), DEFAULT_REMOTE_COMMAND); String remoteCommand = props.getProperty(REMOTE_COMMAND_NAME); if (remoteCommand != null) { this.remoteCommand = remoteCommand; } - String entityConfigXMLFile = - props.getProperty(ENTITY_CONFIG_XML_FILE_NAME); + String entityConfigXMLFile = props.getProperty(ENTITY_CONFIG_XML_FILE_NAME); if (entityConfigXMLFile != null) { this.entityConfigXMLFile = entityConfigXMLFile; } - String refreshInterval = - props.getProperty(REFRESH_INTERVAL_NAME); + String refreshInterval = props.getProperty(REFRESH_INTERVAL_NAME); if (refreshInterval != null) { try { this.refreshInterval = Integer.parseInt(refreshInterval); } catch (NumberFormatException nfEx) { throw new IllegalArgumentException( - LocalizedStrings.DistributedSystemConfigImpl_0_IS_NOT_A_VALID_INTEGER_1.toLocalizedString(new Object[] { refreshInterval, REFRESH_INTERVAL_NAME })); + LocalizedStrings.DistributedSystemConfigImpl_0_IS_NOT_A_VALID_INTEGER_1 + .toLocalizedString(new Object[] {refreshInterval, REFRESH_INTERVAL_NAME})); } } } - ////////////////////// Instance Methods ////////////////////// + ////////////////////// Instance Methods ////////////////////// /** - * Returns the <code>LogWriterI18n</code> to be used when administering - * the distributed system. Returns null if nothing has been provided via - * <code>setInternalLogWriter</code>. + * Returns the <code>LogWriterI18n</code> to be used when administering the distributed system. + * Returns null if nothing has been provided via <code>setInternalLogWriter</code>. * * @since GemFire 4.0 */ public InternalLogWriter getInternalLogWriter() { - // LOG: used only for sharing between IDS, AdminDSImpl and AgentImpl -- to prevent multiple banners, etc. + // LOG: used only for sharing between IDS, AdminDSImpl and AgentImpl -- to prevent multiple + // banners, etc. synchronized (this) { return this.logWriter; } } /** - * Sets the <code>LogWriterI18n</code> to be used when administering the - * distributed system. + * Sets the <code>LogWriterI18n</code> to be used when administering the distributed system. */ public void setInternalLogWriter(InternalLogWriter logWriter) { - // LOG: used only for sharing between IDS, AdminDSImpl and AgentImpl -- to prevent multiple banners, etc. + // LOG: used only for sharing between IDS, AdminDSImpl and AgentImpl -- to prevent multiple + // banners, etc. synchronized (this) { this.logWriter = logWriter; } @@ -304,9 +283,8 @@ public class DistributedSystemConfigImpl } /** - * Marks this config object as "read only". Attempts to modify a - * config object will result in a {@link IllegalStateException} - * being thrown. + * Marks this config object as "read only". Attempts to modify a config object will result in a + * {@link IllegalStateException} being thrown. * * @since GemFire 4.0 */ @@ -315,8 +293,8 @@ public class DistributedSystemConfigImpl } /** - * Checks to see if this config object is "read only". If it is, - * then an {@link IllegalStateException} is thrown. + * Checks to see if this config object is "read only". If it is, then an + * {@link IllegalStateException} is thrown. * * @since GemFire 4.0 */ @@ -339,8 +317,7 @@ public class DistributedSystemConfigImpl } /** - * Parses the XML configuration file that describes managed - * entities. + * Parses the XML configuration file that describes managed entities. * * @throws AdminXmlException If a problem is encountered while parsing the XML file. */ @@ -352,7 +329,9 @@ public class DistributedSystemConfigImpl // Default doesn't exist, no big deal return; } else { - throw new AdminXmlException(LocalizedStrings.DistributedSystemConfigImpl_ENTITY_CONFIGURATION_XML_FILE_0_DOES_NOT_EXIST.toLocalizedString(fileName)); + throw new AdminXmlException( + LocalizedStrings.DistributedSystemConfigImpl_ENTITY_CONFIGURATION_XML_FILE_0_DOES_NOT_EXIST + .toLocalizedString(fileName)); } } @@ -364,7 +343,9 @@ public class DistributedSystemConfigImpl is.close(); } } catch (IOException ex) { - throw new AdminXmlException(LocalizedStrings.DistributedSystemConfigImpl_WHILE_PARSING_0.toLocalizedString(fileName), ex); + throw new AdminXmlException( + LocalizedStrings.DistributedSystemConfigImpl_WHILE_PARSING_0.toLocalizedString(fileName), + ex); } } @@ -453,16 +434,15 @@ public class DistributedSystemConfigImpl /** * Sets the Distributed System property membership-port-range * - * @param membershipPortRangeStr the value for membership-port-range given as two numbers separated - * by a minus sign. + * @param membershipPortRangeStr the value for membership-port-range given as two numbers + * separated by a minus sign. */ public void setMembershipPortRange(String membershipPortRangeStr) { /* - * FIXME: Setting attributes in DistributedSystemConfig has no effect on - * DistributionConfig which is actually used for connection with DS. This is - * true for all such attributes. Should be addressed in the Admin Revamp if - * we want these 'set' calls to affect anything. Then we can use the - * validation code in DistributionConfigImpl code. + * FIXME: Setting attributes in DistributedSystemConfig has no effect on DistributionConfig + * which is actually used for connection with DS. This is true for all such attributes. Should + * be addressed in the Admin Revamp if we want these 'set' calls to affect anything. Then we can + * use the validation code in DistributionConfigImpl code. */ checkReadOnly(); if (membershipPortRangeStr == null) { @@ -474,8 +454,8 @@ public class DistributedSystemConfigImpl } else { throw new IllegalArgumentException( LocalizedStrings.DistributedSystemConfigImpl_INVALID_VALUE_FOR_MEMBERSHIP_PORT_RANGE - .toLocalizedString(new Object[] { membershipPortRangeStr, - MEMBERSHIP_PORT_RANGE_NAME })); + .toLocalizedString( + new Object[] {membershipPortRangeStr, MEMBERSHIP_PORT_RANGE_NAME})); } } catch (Exception e) { if (logger.isDebugEnabled()) { @@ -496,12 +476,12 @@ public class DistributedSystemConfigImpl } /** - * Validates the given string - which is expected in the format as two numbers - * separated by a minus sign - in to an integer array of length 2 with first - * element as lower end & second element as upper end of the range. + * Validates the given string - which is expected in the format as two numbers separated by a + * minus sign - in to an integer array of length 2 with first element as lower end & second + * element as upper end of the range. * * @param membershipPortRange membership-port-range given as two numbers separated by a minus - * sign. + * sign. * @return true if the membership-port-range string is valid, false otherwise */ private boolean validateMembershipRange(String membershipPortRange) { @@ -511,10 +491,9 @@ public class DistributedSystemConfigImpl range = new int[2]; range[0] = Integer.parseInt(splitted[0].trim()); range[1] = Integer.parseInt(splitted[1].trim()); - //NumberFormatException if any could be thrown + // NumberFormatException if any could be thrown - if (range[0] < 0 || range[0] >= range[1] || - range[1] < 0 || range[1] > 65535) { + if (range[0] < 0 || range[0] >= range[1] || range[1] < 0 || range[1] > 65535) { range = null; } } @@ -522,15 +501,13 @@ public class DistributedSystemConfigImpl } /** - * @return the String representation of membershipPortRange with lower & upper - * limits of the port range separated by '-' e.g. 1-65535 + * @return the String representation of membershipPortRange with lower & upper limits of the port + * range separated by '-' e.g. 1-65535 */ private static String getMembershipPortRangeString(int[] membershipPortRange) { String membershipPortRangeString = ""; - if (membershipPortRange != null && - membershipPortRange.length == 2) { - membershipPortRangeString = membershipPortRange[0] + "-" + - membershipPortRange[1]; + if (membershipPortRange != null && membershipPortRange.length == 2) { + membershipPortRangeString = membershipPortRange[0] + "-" + membershipPortRange[1]; } return membershipPortRangeString; @@ -598,14 +575,18 @@ public class DistributedSystemConfigImpl private void basicSetBindAddress(String bindAddress) { if (!validateBindAddress(bindAddress)) { - throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_INVALID_BIND_ADDRESS_0.toLocalizedString(bindAddress)); + throw new IllegalArgumentException( + LocalizedStrings.DistributedSystemConfigImpl_INVALID_BIND_ADDRESS_0 + .toLocalizedString(bindAddress)); } this.bindAddress = bindAddress; } private void basicSetServerBindAddress(String bindAddress) { if (!validateBindAddress(bindAddress)) { - throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_INVALID_BIND_ADDRESS_0.toLocalizedString(bindAddress)); + throw new IllegalArgumentException( + LocalizedStrings.DistributedSystemConfigImpl_INVALID_BIND_ADDRESS_0 + .toLocalizedString(bindAddress)); } this.serverBindAddress = bindAddress; } @@ -618,9 +599,8 @@ public class DistributedSystemConfigImpl } /** - * Sets the remote command for this config object. This attribute - * may be modified after this config object has been used to create - * an admin distributed system. + * Sets the remote command for this config object. This attribute may be modified after this + * config object has been used to create an admin distributed system. */ public void setRemoteCommand(String remoteCommand) { if (!ALLOW_ALL_REMOTE_COMMANDS) { @@ -630,9 +610,11 @@ public class DistributedSystemConfigImpl configChanged(); } - private static final boolean ALLOW_ALL_REMOTE_COMMANDS = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "admin.ALLOW_ALL_REMOTE_COMMANDS"); - private static final String[] LEGAL_REMOTE_COMMANDS = { "rsh", "ssh" }; - private static final String ILLEGAL_REMOTE_COMMAND_RSH_OR_SSH = "Allowed remote commands include \"rsh {HOST} {CMD}\" or \"ssh {HOST} {CMD}\" with valid rsh or ssh switches. Invalid: "; + private static final boolean ALLOW_ALL_REMOTE_COMMANDS = + Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "admin.ALLOW_ALL_REMOTE_COMMANDS"); + private static final String[] LEGAL_REMOTE_COMMANDS = {"rsh", "ssh"}; + private static final String ILLEGAL_REMOTE_COMMAND_RSH_OR_SSH = + "Allowed remote commands include \"rsh {HOST} {CMD}\" or \"ssh {HOST} {CMD}\" with valid rsh or ssh switches. Invalid: "; private final void checkRemoteCommand(final String remoteCommand) { if (remoteCommand == null || remoteCommand.isEmpty()) { @@ -653,7 +635,8 @@ public class DistributedSystemConfigImpl for (int j = 0; j < LEGAL_REMOTE_COMMANDS.length; j++) { if (string.contains(LEGAL_REMOTE_COMMANDS[j])) { // verify command is at end of string - if (!(string.endsWith(LEGAL_REMOTE_COMMANDS[j]) || string.endsWith(LEGAL_REMOTE_COMMANDS[j] + ".exe"))) { + if (!(string.endsWith(LEGAL_REMOTE_COMMANDS[j]) + || string.endsWith(LEGAL_REMOTE_COMMANDS[j] + ".exe"))) { throw new IllegalArgumentException(ILLEGAL_REMOTE_COMMAND_RSH_OR_SSH + remoteCommand); } found = true; @@ -666,9 +649,11 @@ public class DistributedSystemConfigImpl final boolean isSwitch = string.startsWith("-"); final boolean isHostOrCmd = string.equals("{host}") || string.equals("{cmd}"); - // additional elements must be switches or values-for-switches or {host} or user@{host} or {cmd} + // additional elements must be switches or values-for-switches or {host} or user@{host} or + // {cmd} if (!isSwitch && !isHostOrCmd) { - final String previous = (array == null || array.isEmpty()) ? null : array.get(array.size() - 1); + final String previous = + (array == null || array.isEmpty()) ? null : array.get(array.size() - 1); final boolean isValueForSwitch = previous != null && previous.startsWith("-"); final boolean isHostWithUser = string.contains("@") && string.endsWith("{host}"); @@ -692,18 +677,18 @@ public class DistributedSystemConfigImpl } /** - * Returns an array of configurations for statically known - * CacheServers + * Returns an array of configurations for statically known CacheServers * * @since GemFire 4.0 - */ + */ public CacheServerConfig[] getCacheServerConfigs() { - return (CacheServerConfig[]) this.cacheServerConfigs.toArray( - new CacheServerConfig[this.cacheServerConfigs.size()]); + return (CacheServerConfig[]) this.cacheServerConfigs + .toArray(new CacheServerConfig[this.cacheServerConfigs.size()]); } public CacheVmConfig[] getCacheVmConfigs() { - return (CacheVmConfig[]) this.cacheServerConfigs.toArray(new CacheVmConfig[this.cacheServerConfigs.size()]); + return (CacheVmConfig[]) this.cacheServerConfigs + .toArray(new CacheVmConfig[this.cacheServerConfigs.size()]); } /** @@ -731,7 +716,7 @@ public class DistributedSystemConfigImpl if (managerConfig == null) return; - for (Iterator iter = this.cacheServerConfigs.iterator(); iter.hasNext(); ) { + for (Iterator iter = this.cacheServerConfigs.iterator(); iter.hasNext();) { CacheServerConfigImpl impl = (CacheServerConfigImpl) iter.next(); if (impl.equals(managerConfig)) { return; @@ -761,18 +746,15 @@ public class DistributedSystemConfigImpl */ public DistributionLocatorConfig[] getDistributionLocatorConfigs() { if (this.system != null) { - DistributionLocator[] locators = - this.system.getDistributionLocators(); - DistributionLocatorConfig[] configs = - new DistributionLocatorConfig[locators.length]; + DistributionLocator[] locators = this.system.getDistributionLocators(); + DistributionLocatorConfig[] configs = new DistributionLocatorConfig[locators.length]; for (int i = 0; i < locators.length; i++) { configs[i] = locators[i].getConfig(); } return configs; } else { - Object[] array = - new DistributionLocatorConfig[this.locatorConfigs.size()]; + Object[] array = new DistributionLocatorConfig[this.locatorConfigs.size()]; return (DistributionLocatorConfig[]) this.locatorConfigs.toArray(array); } } @@ -806,9 +788,9 @@ public class DistributedSystemConfigImpl } /** - * Validates the bind address. The address may be a host name or IP address, - * but it must not be empty and must be usable for creating an InetAddress. - * Cannot have a leading '/' (which InetAddress.toString() produces). + * Validates the bind address. The address may be a host name or IP address, but it must not be + * empty and must be usable for creating an InetAddress. Cannot have a leading '/' (which + * InetAddress.toString() produces). * * @param bindAddress host name or IP address to validate */ @@ -823,8 +805,7 @@ public class DistributedSystemConfigImpl public synchronized void configChanged() { ConfigListener[] clients = null; synchronized (this.listeners) { - clients = (ConfigListener[]) - listeners.toArray(new ConfigListener[this.listeners.size()]); + clients = (ConfigListener[]) listeners.toArray(new ConfigListener[this.listeners.size()]); } for (int i = 0; i < clients.length; i++) { try { @@ -854,16 +835,12 @@ public class DistributedSystemConfigImpl } // ------------------------------------------------------------------------- - // SSL support... + // SSL support... // ------------------------------------------------------------------------- - private boolean sslEnabled = - DistributionConfig.DEFAULT_SSL_ENABLED; - private String sslProtocols = - DistributionConfig.DEFAULT_SSL_PROTOCOLS; - private String sslCiphers = - DistributionConfig.DEFAULT_SSL_CIPHERS; - private boolean sslAuthenticationRequired = - DistributionConfig.DEFAULT_SSL_REQUIRE_AUTHENTICATION; + private boolean sslEnabled = DistributionConfig.DEFAULT_SSL_ENABLED; + private String sslProtocols = DistributionConfig.DEFAULT_SSL_PROTOCOLS; + private String sslCiphers = DistributionConfig.DEFAULT_SSL_CIPHERS; + private boolean sslAuthenticationRequired = DistributionConfig.DEFAULT_SSL_REQUIRE_AUTHENTICATION; private Properties sslProperties = new Properties(); public boolean isSSLEnabled() { @@ -996,37 +973,41 @@ public class DistributedSystemConfigImpl } /** - * Makes sure that the mcast port and locators are correct and - * consistent. + * Makes sure that the mcast port and locators are correct and consistent. * * @throws IllegalArgumentException If configuration is not valid */ public void validate() { - if (this.getMcastPort() < MIN_MCAST_PORT || - this.getMcastPort() > MAX_MCAST_PORT) { - throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_MCASTPORT_MUST_BE_AN_INTEGER_INCLUSIVELY_BETWEEN_0_AND_1 - .toLocalizedString(new Object[] { Integer.valueOf(MIN_MCAST_PORT), Integer.valueOf(MAX_MCAST_PORT) })); + if (this.getMcastPort() < MIN_MCAST_PORT || this.getMcastPort() > MAX_MCAST_PORT) { + throw new IllegalArgumentException( + LocalizedStrings.DistributedSystemConfigImpl_MCASTPORT_MUST_BE_AN_INTEGER_INCLUSIVELY_BETWEEN_0_AND_1 + .toLocalizedString( + new Object[] {Integer.valueOf(MIN_MCAST_PORT), Integer.valueOf(MAX_MCAST_PORT)})); } // disabled in 5.1 - multicast and locators can be used together - //if (!DEFAULT_LOCATORS.equals(this.getLocators()) && - // this.mcastPort > 0) { - // throw new IllegalArgumentException( - // "mcastPort must be zero when locators are specified"); - //} + // if (!DEFAULT_LOCATORS.equals(this.getLocators()) && + // this.mcastPort > 0) { + // throw new IllegalArgumentException( + // "mcastPort must be zero when locators are specified"); + // } LogWriterImpl.levelNameToCode(this.logLevel); - if (this.logFileSizeLimit < MIN_LOG_FILE_SIZE_LIMIT || - this.logFileSizeLimit > MAX_LOG_FILE_SIZE_LIMIT) { - throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_LOGFILESIZELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1 - .toLocalizedString(new Object[] { Integer.valueOf(MIN_LOG_FILE_SIZE_LIMIT), Integer.valueOf(MAX_LOG_FILE_SIZE_LIMIT) })); + if (this.logFileSizeLimit < MIN_LOG_FILE_SIZE_LIMIT + || this.logFileSizeLimit > MAX_LOG_FILE_SIZE_LIMIT) { + throw new IllegalArgumentException( + LocalizedStrings.DistributedSystemConfigImpl_LOGFILESIZELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1 + .toLocalizedString(new Object[] {Integer.valueOf(MIN_LOG_FILE_SIZE_LIMIT), + Integer.valueOf(MAX_LOG_FILE_SIZE_LIMIT)})); } - if (this.logDiskSpaceLimit < MIN_LOG_DISK_SPACE_LIMIT || - this.logDiskSpaceLimit > MAX_LOG_DISK_SPACE_LIMIT) { - throw new IllegalArgumentException(LocalizedStrings.DistributedSystemConfigImpl_LOGDISKSPACELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1 - .toLocalizedString(new Object[] { Integer.valueOf(MIN_LOG_DISK_SPACE_LIMIT), Integer.valueOf(MAX_LOG_DISK_SPACE_LIMIT) })); + if (this.logDiskSpaceLimit < MIN_LOG_DISK_SPACE_LIMIT + || this.logDiskSpaceLimit > MAX_LOG_DISK_SPACE_LIMIT) { + throw new IllegalArgumentException( + LocalizedStrings.DistributedSystemConfigImpl_LOGDISKSPACELIMIT_MUST_BE_AN_INTEGER_BETWEEN_0_AND_1 + .toLocalizedString(new Object[] {Integer.valueOf(MIN_LOG_DISK_SPACE_LIMIT), + Integer.valueOf(MAX_LOG_DISK_SPACE_LIMIT)})); } parseEntityConfigXMLFile(); @@ -1037,14 +1018,12 @@ public class DistributedSystemConfigImpl */ @Override public Object clone() throws CloneNotSupportedException { - DistributedSystemConfigImpl other = - (DistributedSystemConfigImpl) super.clone(); + DistributedSystemConfigImpl other = (DistributedSystemConfigImpl) super.clone(); other.system = null; other.cacheServerConfigs = new HashSet(); other.locatorConfigs = new HashSet(); - DistributionLocatorConfig[] myLocators = - this.getDistributionLocatorConfigs(); + DistributionLocatorConfig[] myLocators = this.getDistributionLocatorConfigs(); for (int i = 0; i < myLocators.length; i++) { DistributionLocatorConfig locator = myLocators[i]; other.addDistributionLocatorConfig((DistributionLocatorConfig) locator.clone());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthConfigImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthConfigImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthConfigImpl.java index b7a2057..41b7f12 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthConfigImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthConfigImpl.java @@ -1,58 +1,53 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.admin.internal; import org.apache.geode.admin.*; /** - * The implementation of <code>DistributedSystemHealthConfig</code>. - * Note that because it never leaves the management VM, it is not - * <code>Serializable</code> and is not part of the {@link - * GemFireHealthConfigImpl} class hierarchy. + * The implementation of <code>DistributedSystemHealthConfig</code>. Note that because it never + * leaves the management VM, it is not <code>Serializable</code> and is not part of the + * {@link GemFireHealthConfigImpl} class hierarchy. * * * @since GemFire 3.5 */ -public class DistributedSystemHealthConfigImpl - implements DistributedSystemHealthConfig { +public class DistributedSystemHealthConfigImpl implements DistributedSystemHealthConfig { - /** The maximum number of application members that can - * unexceptedly leave a healthy the distributed system. */ - private long maxDepartedApplications = - DEFAULT_MAX_DEPARTED_APPLICATIONS; + /** + * The maximum number of application members that can unexceptedly leave a healthy the distributed + * system. + */ + private long maxDepartedApplications = DEFAULT_MAX_DEPARTED_APPLICATIONS; - ////////////////////// Constructors ////////////////////// + ////////////////////// Constructors ////////////////////// /** - * Creates a new <code>DistributedSystemHealthConfigImpl</code> with - * the default configuration. + * Creates a new <code>DistributedSystemHealthConfigImpl</code> with the default configuration. */ protected DistributedSystemHealthConfigImpl() { } - ///////////////////// Instance Methods ///////////////////// + ///////////////////// Instance Methods ///////////////////// public long getMaxDepartedApplications() { return this.maxDepartedApplications; } - public void setMaxDepartedApplications(long maxDepartedApplications) - { + public void setMaxDepartedApplications(long maxDepartedApplications) { this.maxDepartedApplications = maxDepartedApplications; } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthEvaluator.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthEvaluator.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthEvaluator.java index 287de7f..a352616 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthEvaluator.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthEvaluator.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.admin.internal; @@ -28,46 +26,43 @@ import java.util.List; import java.util.Set; /** - * Contains the logic for evaluating the health of an entire GemFire - * distributed system according to the thresholds provided in a {@link - * DistributedSystemHealthConfig}. + * Contains the logic for evaluating the health of an entire GemFire distributed system according to + * the thresholds provided in a {@link DistributedSystemHealthConfig}. * * <P> * - * Note that unlike other evaluators, the - * <code>DistributedSystemHealthEvaluator</code> resides in the - * "administrator" VM and not in the member VMs. This is because - * there only needs to be one - * <code>DistributedSystemHealthEvaluator</code> per distributed - * system. + * Note that unlike other evaluators, the <code>DistributedSystemHealthEvaluator</code> resides in + * the "administrator" VM and not in the member VMs. This is because there only needs to be one + * <code>DistributedSystemHealthEvaluator</code> per distributed system. * * * @since GemFire 3.5 - * */ -class DistributedSystemHealthEvaluator - extends AbstractHealthEvaluator implements MembershipListener { + */ +class DistributedSystemHealthEvaluator extends AbstractHealthEvaluator + implements MembershipListener { /** The config from which we get the evaluation criteria */ private DistributedSystemHealthConfig config; - /** The distribution manager with which this MembershipListener is - * registered */ + /** + * The distribution manager with which this MembershipListener is registered + */ private DM dm; /** The description of the distributed system being evaluated */ private String description; - /** The number of application members that have unexpectedly left - * since the previous evaluation */ + /** + * The number of application members that have unexpectedly left since the previous evaluation + */ private int crashedApplications; - /////////////////////// Constructors /////////////////////// + /////////////////////// Constructors /////////////////////// /** * Creates a new <code>DistributedSystemHealthEvaluator</code> */ - DistributedSystemHealthEvaluator(DistributedSystemHealthConfig config, - DM dm) { + DistributedSystemHealthEvaluator(DistributedSystemHealthConfig config, DM dm) { super(null, dm); this.config = config; @@ -79,9 +74,8 @@ class DistributedSystemHealthEvaluator String desc = null; if (dm instanceof DistributionManager) { - desc = - ((DistributionManager) dm).getDistributionConfigDescription(); - } + desc = ((DistributionManager) dm).getDistributionConfigDescription(); + } if (desc != null) { sb.append(desc); @@ -104,25 +98,27 @@ class DistributedSystemHealthEvaluator this.description = sb.toString(); } - //////////////////// Instance Methods //////////////////// + //////////////////// Instance Methods //////////////////// @Override protected String getDescription() { return this.description; } - /** - * Checks to make sure that the number of application members of - * the distributed system that have left unexpected since the last - * evaluation is less than the {@linkplain - * DistributedSystemHealthConfig#getMaxDepartedApplications - * threshold}. If not, the status is "poor" health. + /** + * Checks to make sure that the number of application members of the distributed system that have + * left unexpected since the last evaluation is less than the + * {@linkplain DistributedSystemHealthConfig#getMaxDepartedApplications threshold}. If not, the + * status is "poor" health. */ void checkDepartedApplications(List status) { synchronized (this) { long threshold = this.config.getMaxDepartedApplications(); if (this.crashedApplications > threshold) { - String s = LocalizedStrings.DistributedSystemHealth_THE_NUMBER_OF_APPLICATIONS_THAT_HAVE_LEFT_THE_DISTRIBUTED_SYSTEM_0_EXCEEDS_THE_THRESHOLD_1.toLocalizedString(new Object[] { Long.valueOf(this.crashedApplications), Long.valueOf(threshold)}); + String s = + LocalizedStrings.DistributedSystemHealth_THE_NUMBER_OF_APPLICATIONS_THAT_HAVE_LEFT_THE_DISTRIBUTED_SYSTEM_0_EXCEEDS_THE_THRESHOLD_1 + .toLocalizedString( + new Object[] {Long.valueOf(this.crashedApplications), Long.valueOf(threshold)}); status.add(poorHealth(s)); } this.crashedApplications = 0; @@ -150,23 +146,22 @@ class DistributedSystemHealthEvaluator if (!crashed) return; synchronized (this) { - int kind = id.getVmKind(); - switch (kind) { + int kind = id.getVmKind(); + switch (kind) { case DistributionManager.LOCATOR_DM_TYPE: case DistributionManager.NORMAL_DM_TYPE: this.crashedApplications++; break; default: break; - } + } } // synchronized } - public void quorumLost(Set<InternalDistributedMember> failures, List<InternalDistributedMember> remaining) { - } + public void quorumLost(Set<InternalDistributedMember> failures, + List<InternalDistributedMember> remaining) {} + + public void memberSuspect(InternalDistributedMember id, InternalDistributedMember whoSuspected, + String reason) {} - public void memberSuspect(InternalDistributedMember id, - InternalDistributedMember whoSuspected, String reason) { - } - } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java index 652a57c..246f518 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemHealthMonitor.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.admin.internal; @@ -51,21 +49,18 @@ import org.apache.geode.internal.logging.LoggingThreadGroup; import org.apache.geode.internal.logging.log4j.LocalizedMessage; /** - * A thread that monitors the health of the distributed system. It is - * kind of like a {@link - * org.apache.geode.distributed.internal.HealthMonitorImpl}. In - * order to get it to place nice with the rest of the health - * monitoring APIs, this class pretends that it is a - * <code>GemFireVM</code>. Kind of hokey, but it beats a bunch of - * special-case code. + * A thread that monitors the health of the distributed system. It is kind of like a + * {@link org.apache.geode.distributed.internal.HealthMonitorImpl}. In order to get it to place nice + * with the rest of the health monitoring APIs, this class pretends that it is a + * <code>GemFireVM</code>. Kind of hokey, but it beats a bunch of special-case code. * * * @since GemFire 3.5 - * */ + */ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { private static final Logger logger = LogService.getLogger(); - + /** Evaluates the health of the distributed system */ private DistributedSystemHealthEvaluator eval; @@ -84,52 +79,50 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { /** The health of the distributed system the last time we checked. */ private GemFireHealth.Health prevHealth = GemFireHealth.GOOD_HEALTH; - /** The most recent <code>OKAY_HEALTH</code> diagnoses of the - * GemFire system */ + /** + * The most recent <code>OKAY_HEALTH</code> diagnoses of the GemFire system + */ private List okayDiagnoses; - /** The most recent <code>POOR_HEALTH</code> diagnoses of the - * GemFire system */ + /** + * The most recent <code>POOR_HEALTH</code> diagnoses of the GemFire system + */ private List poorDiagnoses; - ////////////////////// Constructors ////////////////////// + ////////////////////// Constructors ////////////////////// /** - * Creates a new <code>DistributedSystemHealthMonitor</code> that - * evaluates the health of the distributed system against the given - * thresholds once every <code>interval</code> seconds. + * Creates a new <code>DistributedSystemHealthMonitor</code> that evaluates the health of the + * distributed system against the given thresholds once every <code>interval</code> seconds. * - * @param eval - * Used to evaluate the health of the distributed system - * @param healthImpl - * Receives callbacks when the health of the distributed - * system changes - * @param interval - * How often the health is checked + * @param eval Used to evaluate the health of the distributed system + * @param healthImpl Receives callbacks when the health of the distributed system changes + * @param interval How often the health is checked */ DistributedSystemHealthMonitor(DistributedSystemHealthEvaluator eval, - GemFireHealthImpl healthImpl, - int interval) { + GemFireHealthImpl healthImpl, int interval) { this.eval = eval; this.healthImpl = healthImpl; this.interval = interval; this.okayDiagnoses = new ArrayList(); this.poorDiagnoses = new ArrayList(); - ThreadGroup group = - LoggingThreadGroup.createThreadGroup(LocalizedStrings.DistributedSystemHealthMonitor_HEALTH_MONITORS.toLocalizedString(), logger); - String name = LocalizedStrings.DistributedSystemHealthMonitor_HEALTH_MONITOR_FOR_0.toLocalizedString(eval.getDescription()); + ThreadGroup group = LoggingThreadGroup.createThreadGroup( + LocalizedStrings.DistributedSystemHealthMonitor_HEALTH_MONITORS.toLocalizedString(), + logger); + String name = LocalizedStrings.DistributedSystemHealthMonitor_HEALTH_MONITOR_FOR_0 + .toLocalizedString(eval.getDescription()); this.thread = new Thread(group, this, name); this.thread.setDaemon(true); } /** - * Does the work of monitoring the health of the distributed - * system. + * Does the work of monitoring the health of the distributed system. */ public void run() { if (logger.isDebugEnabled()) { - logger.debug("Monitoring health of {} every {} seconds", this.eval.getDescription(), interval); + logger.debug("Monitoring health of {} every {} seconds", this.eval.getDescription(), + interval); } while (!this.stopRequested) { @@ -143,9 +136,9 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { this.okayDiagnoses.clear(); this.poorDiagnoses.clear(); - for (Iterator iter = status.iterator(); iter.hasNext(); ) { + for (Iterator iter = status.iterator(); iter.hasNext();) { AbstractHealthEvaluator.HealthStatus health = - (AbstractHealthEvaluator.HealthStatus) iter.next(); + (AbstractHealthEvaluator.HealthStatus) iter.next(); if (overallHealth == GemFireHealth.GOOD_HEALTH) { if ((health.getHealthCode() != GemFireHealth.GOOD_HEALTH)) { overallHealth = health.getHealthCode(); @@ -166,12 +159,12 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { break; } } - + if (overallHealth != prevHealth) { healthImpl.healthChanged(this, overallHealth); this.prevHealth = overallHealth; } - + } catch (InterruptedException ex) { // We're all done // No need to reset the interrupted flag, since we're going to exit. @@ -188,7 +181,7 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { /** * Starts this <code>DistributedSystemHealthMonitor</code> */ - void start(){ + void start() { this.thread.start(); } @@ -203,90 +196,103 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { try { this.thread.join(); - } - catch (InterruptedException ex) { + } catch (InterruptedException ex) { Thread.currentThread().interrupt(); - logger.warn(LocalizedMessage.create(LocalizedStrings.DistributedSystemHealthMonitor_INTERRUPTED_WHILE_STOPPING_HEALTH_MONITOR_THREAD), ex); + logger.warn( + LocalizedMessage.create( + LocalizedStrings.DistributedSystemHealthMonitor_INTERRUPTED_WHILE_STOPPING_HEALTH_MONITOR_THREAD), + ex); } } } - ////////////////////// GemFireVM Methods ////////////////////// + ////////////////////// GemFireVM Methods ////////////////////// public java.net.InetAddress getHost() { try { return SocketCreator.getLocalHost(); } catch (Exception ex) { - throw new org.apache.geode.InternalGemFireException(LocalizedStrings.DistributedSystemHealthMonitor_COULD_NOT_GET_LOCALHOST.toLocalizedString()); + throw new org.apache.geode.InternalGemFireException( + LocalizedStrings.DistributedSystemHealthMonitor_COULD_NOT_GET_LOCALHOST + .toLocalizedString()); } } - + public String getName() { -// return getId().toString(); + // return getId().toString(); throw new UnsupportedOperationException("Not a real GemFireVM"); } public java.io.File getWorkingDirectory() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public java.io.File getGemFireDir() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - + public java.util.Date getBirthDate() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public Properties getLicenseInfo(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public Properties getLicenseInfo() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public GemFireMemberStatus getSnapshot() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public RegionSubRegionSnapshot getRegionSnapshot() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public StatResource[] getStats(String statisticsTypeName){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public StatResource[] getStats(String statisticsTypeName) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public StatResource[] getAllStats(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public StatResource[] getAllStats() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - - public DLockInfo[] getDistributedLockInfo(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + + public DLockInfo[] getDistributedLockInfo() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + } + + public void addStatListener(StatListener observer, StatResource observedResource, + Stat observedStat) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public void addStatListener(StatListener observer, - StatResource observedResource, - Stat observedStat){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public void removeStatListener(StatListener observer) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - - public void removeStatListener(StatListener observer){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); - } - public void addHealthListener(HealthListener observer, - GemFireHealthConfig cfg){ + public void addHealthListener(HealthListener observer, GemFireHealthConfig cfg) { } - - public void removeHealthListener(){ + + public void removeHealthListener() { } - public void resetHealthStatus(){ + public void resetHealthStatus() { this.prevHealth = GemFireHealth.GOOD_HEALTH; } - public String[] getHealthDiagnosis(GemFireHealth.Health healthCode){ + public String[] getHealthDiagnosis(GemFireHealth.Health healthCode) { if (healthCode == GemFireHealth.GOOD_HEALTH) { return new String[0]; @@ -303,134 +309,153 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM { } } - public Config getConfig(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public Config getConfig() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public void setConfig(Config cfg){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public void setConfig(Config cfg) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public GfManagerAgent getManagerAgent(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public GfManagerAgent getManagerAgent() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - - public String[] getSystemLogs(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + + public String[] getSystemLogs() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public void setInspectionClasspath(String classpath){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public void setInspectionClasspath(String classpath) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - - public String getInspectionClasspath(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + + public String getInspectionClasspath() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - - public Region[] getRootRegions(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + + public Region[] getRootRegions() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public Region getRegion(CacheInfo c, String path) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public Region createVMRootRegion(CacheInfo c, String name, - RegionAttributes attrs) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public Region createVMRootRegion(CacheInfo c, String name, RegionAttributes attrs) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public Region createSubregion(CacheInfo c, String parentPath, - String name, RegionAttributes attrs) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public Region createSubregion(CacheInfo c, String parentPath, String name, + RegionAttributes attrs) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public void setCacheInspectionMode(int mode) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public int getCacheInspectionMode(){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public int getCacheInspectionMode() { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public void takeRegionSnapshot(String regionName, int snapshotId){ - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public void takeRegionSnapshot(String regionName, int snapshotId) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public InternalDistributedMember getId() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public CacheInfo getCacheInfo() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public String getVersionInfo() { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public CacheInfo setCacheLockTimeout(CacheInfo c, int v) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public CacheInfo setCacheLockLease(CacheInfo c, int v) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } public CacheInfo setCacheSearchTimeout(CacheInfo c, int v) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public AdminBridgeServer addCacheServer(CacheInfo cache) - throws AdminException { + public AdminBridgeServer addCacheServer(CacheInfo cache) throws AdminException { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public AdminBridgeServer getBridgeInfo(CacheInfo cache, - int id) - throws AdminException { + public AdminBridgeServer getBridgeInfo(CacheInfo cache, int id) throws AdminException { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public AdminBridgeServer startBridgeServer(CacheInfo cache, - AdminBridgeServer bridge) - throws AdminException { + public AdminBridgeServer startBridgeServer(CacheInfo cache, AdminBridgeServer bridge) + throws AdminException { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } - public AdminBridgeServer stopBridgeServer(CacheInfo cache, - AdminBridgeServer bridge) - throws AdminException { + public AdminBridgeServer stopBridgeServer(CacheInfo cache, AdminBridgeServer bridge) + throws AdminException { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } /** - * This operation is not supported for this object. Will throw - * UnsupportedOperationException if invoked. + * This operation is not supported for this object. Will throw UnsupportedOperationException if + * invoked. */ - public void setAlertsManager(StatAlertDefinition[] alertDefs, - long refreshInterval, boolean setRemotely) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public void setAlertsManager(StatAlertDefinition[] alertDefs, long refreshInterval, + boolean setRemotely) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } /** - * This operation is not supported for this object. Will throw - * UnsupportedOperationException if invoked. + * This operation is not supported for this object. Will throw UnsupportedOperationException if + * invoked. */ public void setRefreshInterval(long refreshInterval) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } /** - * This operation is not supported for this object. Will throw - * UnsupportedOperationException if invoked. + * This operation is not supported for this object. Will throw UnsupportedOperationException if + * invoked. */ - public void updateAlertDefinitions(StatAlertDefinition[] alertDefs, - int actionCode) { - throw new UnsupportedOperationException(LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); + public void updateAlertDefinitions(StatAlertDefinition[] alertDefs, int actionCode) { + throw new UnsupportedOperationException( + LocalizedStrings.DistributedSystemHealthMonitor_NOT_A_REAL_GEMFIREVM.toLocalizedString()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorConfigImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorConfigImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorConfigImpl.java index 1e23a3e..c3cab6f 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorConfigImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorConfigImpl.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.admin.internal; @@ -27,62 +25,58 @@ import java.util.Properties; import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT; /** - * Provides an implementation of - * <code>DistributionLocatorConfig</code>. + * Provides an implementation of <code>DistributionLocatorConfig</code>. * * @since GemFire 4.0 */ -public class DistributionLocatorConfigImpl - extends ManagedEntityConfigImpl - implements DistributionLocatorConfig { +public class DistributionLocatorConfigImpl extends ManagedEntityConfigImpl + implements DistributionLocatorConfig { /** The minimum networking port (0) */ public static final int MIN_PORT = 0; /** The maximum networking port (65535) */ public static final int MAX_PORT = 65535; - - ////////////////////// Instance Fields ////////////////////// + + ////////////////////// Instance Fields ////////////////////// /** The port on which this locator listens */ private int port; /** The address to bind to on a multi-homed host */ private String bindAddress; - - /** The properties used to configure the DistributionLocator's - DistributedSystem */ + + /** + * The properties used to configure the DistributionLocator's DistributedSystem + */ private Properties dsProperties; /** The DistributionLocator that was created with this config */ private DistributionLocator locator; - ////////////////////// Static Methods ////////////////////// + ////////////////////// Static Methods ////////////////////// /** - * Contacts a distribution locator on the given host and port and - * creates a <code>DistributionLocatorConfig</code> for it. + * Contacts a distribution locator on the given host and port and creates a + * <code>DistributionLocatorConfig</code> for it. * * @see TcpClient#getLocatorInfo * * @return <code>null</code> if the locator cannot be contacted */ - static DistributionLocatorConfig - createConfigFor(String host, int port, InetAddress bindAddress) { + static DistributionLocatorConfig createConfigFor(String host, int port, InetAddress bindAddress) { TcpClient client = new TcpClient(); String[] info = null; if (bindAddress != null) { info = client.getInfo(bindAddress, port); - } - else { + } else { info = client.getInfo(InetAddressUtil.toInetAddress(host), port); } if (info == null) { return null; } - DistributionLocatorConfigImpl config = - new DistributionLocatorConfigImpl(); + DistributionLocatorConfigImpl config = new DistributionLocatorConfigImpl(); config.setHost(host); config.setPort(port); if (bindAddress != null) { @@ -94,11 +88,10 @@ public class DistributionLocatorConfigImpl return config; } - /////////////////////// Constructors /////////////////////// + /////////////////////// Constructors /////////////////////// /** - * Creates a new <code>DistributionLocatorConfigImpl</code> with the - * default settings. + * Creates a new <code>DistributionLocatorConfigImpl</code> with the default settings. */ public DistributionLocatorConfigImpl() { this.port = 0; @@ -108,11 +101,10 @@ public class DistributionLocatorConfigImpl this.dsProperties.setProperty(MCAST_PORT, "0"); } - ///////////////////// Instance Methods ///////////////////// + ///////////////////// Instance Methods ///////////////////// /** - * Sets the locator that was configured with this - * <Code>DistributionLocatorConfigImpl</code>. + * Sets the locator that was configured with this <Code>DistributionLocatorConfigImpl</code>. */ void setLocator(DistributionLocator locator) { this.locator = locator; @@ -142,11 +134,11 @@ public class DistributionLocatorConfigImpl this.bindAddress = bindAddress; configChanged(); } - + public void setDistributedSystemProperties(Properties props) { this.dsProperties = props; } - + public Properties getDistributedSystemProperties() { return this.dsProperties; } @@ -156,12 +148,16 @@ public class DistributionLocatorConfigImpl super.validate(); if (port < MIN_PORT || port > MAX_PORT) { - throw new IllegalArgumentException(LocalizedStrings.DistributionLocatorConfigImpl_PORT_0_MUST_BE_AN_INTEGER_BETWEEN_1_AND_2.toLocalizedString(new Object[] {Integer.valueOf(port), Integer.valueOf(MIN_PORT), Integer.valueOf(MAX_PORT)})); + throw new IllegalArgumentException( + LocalizedStrings.DistributionLocatorConfigImpl_PORT_0_MUST_BE_AN_INTEGER_BETWEEN_1_AND_2 + .toLocalizedString(new Object[] {Integer.valueOf(port), Integer.valueOf(MIN_PORT), + Integer.valueOf(MAX_PORT)})); } - if (this.bindAddress != null && - InetAddressUtil.validateHost(this.bindAddress) == null) { - throw new IllegalArgumentException(LocalizedStrings.DistributionLocatorConfigImpl_INVALID_HOST_0.toLocalizedString(this.bindAddress)); + if (this.bindAddress != null && InetAddressUtil.validateHost(this.bindAddress) == null) { + throw new IllegalArgumentException( + LocalizedStrings.DistributionLocatorConfigImpl_INVALID_HOST_0 + .toLocalizedString(this.bindAddress)); } } @@ -175,8 +171,7 @@ public class DistributionLocatorConfigImpl @Override public Object clone() throws CloneNotSupportedException { - DistributionLocatorConfigImpl clone = - (DistributionLocatorConfigImpl) super.clone(); + DistributionLocatorConfigImpl clone = (DistributionLocatorConfigImpl) super.clone(); clone.locator = null; return clone; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorImpl.java index d8ad205..c1bfc93 100755 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/DistributionLocatorImpl.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.admin.internal; @@ -37,10 +35,9 @@ import java.util.*; /** * Default administrative implementation of a DistributionLocator. * - * @since GemFire 3.5 + * @since GemFire 3.5 */ -public class DistributionLocatorImpl - implements DistributionLocator, InternalManagedEntity { +public class DistributionLocatorImpl implements DistributionLocator, InternalManagedEntity { private static final Logger logger = LogService.getLogger(); @@ -49,7 +46,7 @@ public class DistributionLocatorImpl */ private static int newLocators = 0; - //////////////////// Instance Fields //////////////////// + //////////////////// Instance Fields //////////////////// /** * The configuration object for this locator @@ -72,12 +69,12 @@ public class DistributionLocatorImpl private AdminDistributedSystemImpl system; // ------------------------------------------------------------------------- - // constructor(s)... + // constructor(s)... // ------------------------------------------------------------------------- /** - * Constructs new instance of <code>DistributionLocatorImpl</code> - * that is a member of the given distributed system. + * Constructs new instance of <code>DistributionLocatorImpl</code> that is a member of the given + * distributed system. */ public DistributionLocatorImpl(DistributionLocatorConfig config, AdminDistributedSystemImpl system) { @@ -90,7 +87,7 @@ public class DistributionLocatorImpl } // ------------------------------------------------------------------------- - // Attribute accessors/mutators... + // Attribute accessors/mutators... // ------------------------------------------------------------------------- public String getId() { @@ -117,26 +114,24 @@ public class DistributionLocatorImpl } /** - * Unfortunately, it doesn't make much sense to maintain the state - * of a locator. The admin API does not receive notification when - * the locator actually starts and stops. If we try to guess, we'll - * just end up with race conditions galore. So, we can't fix bug - * 32455 for locators. + * Unfortunately, it doesn't make much sense to maintain the state of a locator. The admin API + * does not receive notification when the locator actually starts and stops. If we try to guess, + * we'll just end up with race conditions galore. So, we can't fix bug 32455 for locators. */ public int setState(int state) { - throw new UnsupportedOperationException(LocalizedStrings.DistributionLocatorImpl_CAN_NOT_SET_THE_STATE_OF_A_LOCATOR.toLocalizedString()); + throw new UnsupportedOperationException( + LocalizedStrings.DistributionLocatorImpl_CAN_NOT_SET_THE_STATE_OF_A_LOCATOR + .toLocalizedString()); } // ------------------------------------------------------------------------- - // Operations... + // Operations... // ------------------------------------------------------------------------- /** - * Polls to determine whether or not this managed entity has - * started. + * Polls to determine whether or not this managed entity has started. */ - public boolean waitToStart(long timeout) - throws InterruptedException { + public boolean waitToStart(long timeout) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); @@ -151,17 +146,15 @@ public class DistributionLocatorImpl } } - logger.info(LocalizedMessage.create( - LocalizedStrings.DistributionLocatorImpl_DONE_WAITING_FOR_LOCATOR)); + logger.info( + LocalizedMessage.create(LocalizedStrings.DistributionLocatorImpl_DONE_WAITING_FOR_LOCATOR)); return this.isRunning(); } /** - * Polls to determine whether or not this managed entity has - * stopped. + * Polls to determine whether or not this managed entity has stopped. */ - public boolean waitToStop(long timeout) - throws InterruptedException { + public boolean waitToStop(long timeout) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); @@ -195,8 +188,10 @@ public class DistributionLocatorImpl boolean found = false; Map<InternalDistributedMember, Collection<String>> hostedLocators = dm.getAllHostedLocators(); - for (Iterator<InternalDistributedMember> memberIter = hostedLocators.keySet().iterator(); memberIter.hasNext(); ) { - for (Iterator<String> locatorIter = hostedLocators.get(memberIter.next()).iterator(); locatorIter.hasNext(); ) { + for (Iterator<InternalDistributedMember> memberIter = + hostedLocators.keySet().iterator(); memberIter.hasNext();) { + for (Iterator<String> locatorIter = + hostedLocators.get(memberIter.next()).iterator(); locatorIter.hasNext();) { DistributionLocatorId locator = new DistributionLocatorId(locatorIter.next()); found = found || locator.getHost().getHostAddress().equals(host); found = found || locator.getHost().getHostName().equals(host); @@ -250,7 +245,7 @@ public class DistributionLocatorImpl return "DistributionLocator " + getId(); } - //////////////////////// Command execution //////////////////////// + //////////////////////// Command execution //////////////////////// public ManagedEntityConfig getEntityConfig() { return this.getConfig(); @@ -281,8 +276,7 @@ public class DistributionLocatorImpl } sb.append(" "); - String sslArgs = - this.controller.buildSSLArguments(this.system.getConfig()); + String sslArgs = this.controller.buildSSLArguments(this.system.getConfig()); if (sslArgs != null) { sb.append(sslArgs); } @@ -305,8 +299,7 @@ public class DistributionLocatorImpl } sb.append(" "); - String sslArgs = - this.controller.buildSSLArguments(this.system.getConfig()); + String sslArgs = this.controller.buildSSLArguments(this.system.getConfig()); if (sslArgs != null) { sb.append(sslArgs); }
