http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java b/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java index 6c76f69..951b364 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/MemberHealthEvaluator.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; @@ -30,9 +28,8 @@ import org.apache.geode.internal.statistics.platform.ProcessStats; import java.util.*; /** - * Contains the logic for evaluating the health of a GemFire - * distributed system member according to the thresholds provided in a - * {@link MemberHealthConfig}. + * Contains the logic for evaluating the health of a GemFire distributed system member according to + * the thresholds provided in a {@link MemberHealthConfig}. * * @see VMStats * @see ProcessStats @@ -52,8 +49,8 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { /** The description of the member being evaluated */ private String description; -// /** Statistics about this VM (may be null) */ -// private VMStatsContract vmStats; + // /** Statistics about this VM (may be null) */ + // private VMStatsContract vmStats; /** Statistics about this process (may be null) */ private ProcessStats processStats; @@ -64,13 +61,12 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { /** The previous value of the reply timeouts stat */ private long prevReplyTimeouts; - ////////////////////// Constructors ////////////////////// + ////////////////////// Constructors ////////////////////// /** * Creates a new <code>MemberHealthEvaluator</code> */ - MemberHealthEvaluator(GemFireHealthConfig config, - DM dm) { + MemberHealthEvaluator(GemFireHealthConfig config, DM dm) { super(config, dm); this.config = config; @@ -79,12 +75,12 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { GemFireStatSampler sampler = system.getStatSampler(); if (sampler != null) { // Sampling is enabled -// this.vmStats = sampler.getVMStats(); + // this.vmStats = sampler.getVMStats(); this.processStats = sampler.getProcessStats(); } this.dmStats = dm.getStats(); - + StringBuffer sb = new StringBuffer(); sb.append("Application VM member "); sb.append(dm.getId()); @@ -96,7 +92,7 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { this.description = sb.toString(); } - //////////////////// Instance Methods //////////////////// + //////////////////// Instance Methods //////////////////// @Override protected String getDescription() { @@ -104,10 +100,9 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { } /** - * Checks to make sure that the {@linkplain - * ProcessStats#getProcessSize VM's process size} is less than the - * {@linkplain MemberHealthConfig#getMaxVMProcessSize threshold}. - * If not, the status is "okay" health. + * Checks to make sure that the {@linkplain ProcessStats#getProcessSize VM's process size} is less + * than the {@linkplain MemberHealthConfig#getMaxVMProcessSize threshold}. If not, the status is + * "okay" health. */ void checkVMProcessSize(List status) { // There is no need to check isFirstEvaluation() @@ -118,32 +113,35 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { long vmSize = this.processStats.getProcessSize(); long threshold = this.config.getMaxVMProcessSize(); if (vmSize > threshold) { - String s = LocalizedStrings.MemberHealthEvaluator_THE_SIZE_OF_THIS_VM_0_MEGABYTES_EXCEEDS_THE_THRESHOLD_1_MEGABYTES.toLocalizedString(new Object[] {Long.valueOf(vmSize), Long.valueOf(threshold)}); + String s = + LocalizedStrings.MemberHealthEvaluator_THE_SIZE_OF_THIS_VM_0_MEGABYTES_EXCEEDS_THE_THRESHOLD_1_MEGABYTES + .toLocalizedString(new Object[] {Long.valueOf(vmSize), Long.valueOf(threshold)}); status.add(okayHealth(s)); } } /** * Checks to make sure that the size of the distribution manager's - * {@linkplain DMStats#getOverflowQueueSize() overflow} message - * queue does not exceed the {@linkplain - * MemberHealthConfig#getMaxMessageQueueSize threshold}. If not, - * the status is "okay" health. + * {@linkplain DMStats#getOverflowQueueSize() overflow} message queue does not exceed the + * {@linkplain MemberHealthConfig#getMaxMessageQueueSize threshold}. If not, the status is "okay" + * health. */ void checkMessageQueueSize(List status) { long threshold = this.config.getMaxMessageQueueSize(); long overflowSize = this.dmStats.getOverflowQueueSize(); if (overflowSize > threshold) { - String s = LocalizedStrings.MemberHealthEvaluator_THE_SIZE_OF_THE_OVERFLOW_QUEUE_0_EXCEEDS_THE_THRESHOLD_1.toLocalizedString(new Object[] { Long.valueOf(overflowSize), Long.valueOf(threshold)}); + String s = + LocalizedStrings.MemberHealthEvaluator_THE_SIZE_OF_THE_OVERFLOW_QUEUE_0_EXCEEDS_THE_THRESHOLD_1 + .toLocalizedString( + new Object[] {Long.valueOf(overflowSize), Long.valueOf(threshold)}); status.add(okayHealth(s)); } } /** - * Checks to make sure that the number of {@linkplain - * DMStats#getReplyTimeouts reply timeouts} does not exceed the - * {@linkplain MemberHealthConfig#getMaxReplyTimeouts threshold}. - * If not, the status is "okay" health. + * Checks to make sure that the number of {@linkplain DMStats#getReplyTimeouts reply timeouts} + * does not exceed the {@linkplain MemberHealthConfig#getMaxReplyTimeouts threshold}. If not, the + * status is "okay" health. */ void checkReplyTimeouts(List status) { if (isFirstEvaluation()) { @@ -151,10 +149,12 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { } long threshold = this.config.getMaxReplyTimeouts(); - long deltaReplyTimeouts = - this.dmStats.getReplyTimeouts() - prevReplyTimeouts; + long deltaReplyTimeouts = this.dmStats.getReplyTimeouts() - prevReplyTimeouts; if (deltaReplyTimeouts > threshold) { - String s = LocalizedStrings.MemberHealthEvaluator_THE_NUMBER_OF_MESSAGE_REPLY_TIMEOUTS_0_EXCEEDS_THE_THRESHOLD_1.toLocalizedString(new Object[] { Long.valueOf(deltaReplyTimeouts), Long.valueOf(threshold)}); + String s = + LocalizedStrings.MemberHealthEvaluator_THE_NUMBER_OF_MESSAGE_REPLY_TIMEOUTS_0_EXCEEDS_THE_THRESHOLD_1 + .toLocalizedString( + new Object[] {Long.valueOf(deltaReplyTimeouts), Long.valueOf(threshold)}); status.add(okayHealth(s)); } } @@ -168,54 +168,59 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { if (mcastMessages > 100000) { // avoid initial state & int overflow // the ratio we actually use here is (retransmit requests) / (mcast datagram writes) // a single retransmit request may include multiple missed messages - double ratio = (this.dmStats.getMcastRetransmits() * 1.0) / - (this.dmStats.getMcastWrites() * 1.0); + double ratio = + (this.dmStats.getMcastRetransmits() * 1.0) / (this.dmStats.getMcastWrites() * 1.0); if (ratio > threshold) { - String s = "The number of message retransmissions (" + - ratio + ") exceeds the threshold (" + threshold + ")"; + String s = "The number of message retransmissions (" + ratio + ") exceeds the threshold (" + + threshold + ")"; status.add(okayHealth(s)); } } } - -/** - * The function keeps updating the health of the cache based on - * roles required by the regions and their reliablity policies. - * - * */ - - void checkCacheRequiredRolesMeet(List status){ - // will have to call here okeyHealth() or poorHealth() - //GemFireCache cache = (GemFireCache)CacheFactory.getAnyInstance(); - - //CachePerfStats cPStats= null; - try{ - GemFireCacheImpl cache = (GemFireCacheImpl)CacheFactory.getAnyInstance(); - CachePerfStats cPStats= null; - cPStats= cache.getCachePerfStats(); - - if(cPStats.getReliableRegionsMissingFullAccess()> 0){ - // health is okay. - int numRegions = cPStats.getReliableRegionsMissingFullAccess(); - status.add(okayHealth(LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_BUT_ARE_CONFIGURED_FOR_FULL_ACCESS.toLocalizedString(Integer.valueOf(numRegions)))); - }else if(cPStats.getReliableRegionsMissingLimitedAccess() > 0){ - // health is poor - int numRegions = cPStats.getReliableRegionsMissingLimitedAccess(); - status.add(poorHealth(LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_AND_CONFIGURED_WITH_LIMITED_ACCESS.toLocalizedString(Integer.valueOf(numRegions)))); - }else if (cPStats.getReliableRegionsMissingNoAccess() > 0){ - // health is poor - int numRegions = cPStats.getReliableRegionsMissingNoAccess(); - status.add(poorHealth(LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_AND_CONFIGURED_WITHOUT_ACCESS.toLocalizedString(Integer.valueOf(numRegions)))); - }//else{ - // health is good/okay - // status.add(okayHealth("All regions have there required roles meet")); - //} - } - catch (CancelException ignore) { - } + + /** + * The function keeps updating the health of the cache based on roles required by the regions and + * their reliablity policies. + * + */ + + void checkCacheRequiredRolesMeet(List status) { + // will have to call here okeyHealth() or poorHealth() + // GemFireCache cache = (GemFireCache)CacheFactory.getAnyInstance(); + + // CachePerfStats cPStats= null; + try { + GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance(); + CachePerfStats cPStats = null; + cPStats = cache.getCachePerfStats(); + + if (cPStats.getReliableRegionsMissingFullAccess() > 0) { + // health is okay. + int numRegions = cPStats.getReliableRegionsMissingFullAccess(); + status.add(okayHealth( + LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_BUT_ARE_CONFIGURED_FOR_FULL_ACCESS + .toLocalizedString(Integer.valueOf(numRegions)))); + } else if (cPStats.getReliableRegionsMissingLimitedAccess() > 0) { + // health is poor + int numRegions = cPStats.getReliableRegionsMissingLimitedAccess(); + status.add(poorHealth( + LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_AND_CONFIGURED_WITH_LIMITED_ACCESS + .toLocalizedString(Integer.valueOf(numRegions)))); + } else if (cPStats.getReliableRegionsMissingNoAccess() > 0) { + // health is poor + int numRegions = cPStats.getReliableRegionsMissingNoAccess(); + status.add(poorHealth( + LocalizedStrings.MemberHealthEvaluator_THERE_ARE_0_REGIONS_MISSING_REQUIRED_ROLES_AND_CONFIGURED_WITHOUT_ACCESS + .toLocalizedString(Integer.valueOf(numRegions)))); + } // else{ + // health is good/okay + // status.add(okayHealth("All regions have there required roles meet")); + // } + } catch (CancelException ignore) { + } } - + /** * Updates the previous values of statistics */ @@ -228,7 +233,7 @@ class MemberHealthEvaluator extends AbstractHealthEvaluator { checkVMProcessSize(status); checkMessageQueueSize(status); checkReplyTimeouts(status); - // will have to add another call to check for roles + // will have to add another call to check for roles // missing and reliablity attributed. checkCacheRequiredRolesMeet(status);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java index f90a8e7..7025721 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.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; @@ -44,20 +42,19 @@ import org.apache.geode.internal.logging.LogService; import org.apache.geode.internal.logging.log4j.LocalizedMessage; /** - * A request to from an admin VM to all non admin members - * to start a backup. In the prepare phase of the backup, - * the members will suspend bucket destroys to make sure - * buckets aren't missed during the backup. + * A request to from an admin VM to all non admin members to start a backup. In the prepare phase of + * the backup, the members will suspend bucket destroys to make sure buckets aren't missed during + * the backup. * * */ -public class PrepareBackupRequest extends CliLegacyMessage { +public class PrepareBackupRequest extends CliLegacyMessage { private static final Logger logger = LogService.getLogger(); - + public PrepareBackupRequest() { - + } - + public static Map<DistributedMember, Set<PersistentID>> send(DM dm, Set recipients) { PrepareBackupRequest request = new PrepareBackupRequest(); request.setRecipients(recipients); @@ -68,31 +65,32 @@ public class PrepareBackupRequest extends CliLegacyMessage { try { replyProcessor.waitForReplies(); } catch (ReplyException e) { - if(!(e.getCause() instanceof CancelException)) { + if (!(e.getCause() instanceof CancelException)) { throw e; } } catch (InterruptedException e) { e.printStackTrace(); } - AdminResponse response = request.createResponse((DistributionManager)dm); + AdminResponse response = request.createResponse((DistributionManager) dm); response.setSender(dm.getDistributionManagerId()); replyProcessor.process(response); return replyProcessor.results; } - + @Override protected AdminResponse createResponse(DistributionManager dm) { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); HashSet<PersistentID> persistentIds; - if(cache == null) { + if (cache == null) { persistentIds = new HashSet<PersistentID>(); } else { try { BackupManager manager = cache.startBackup(getSender()); persistentIds = manager.prepareBackup(); - } catch(IOException e) { - logger.error(LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e); - return AdminFailureResponse.create(dm, getSender(), e); + } catch (IOException e) { + logger.error( + LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e); + return AdminFailureResponse.create(dm, getSender(), e); } } @@ -103,13 +101,15 @@ public class PrepareBackupRequest extends CliLegacyMessage { public int getDSFID() { return PREPARE_BACKUP_REQUEST; } - + private static class PrepareBackupReplyProcessor extends AdminMultipleReplyProcessor { - Map<DistributedMember, Set<PersistentID>> results = Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>()); + Map<DistributedMember, Set<PersistentID>> results = + Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>()); + public PrepareBackupReplyProcessor(DM dm, Collection initMembers) { super(dm, initMembers); } - + @Override protected boolean stopBecauseOfExceptions() { return false; @@ -117,16 +117,17 @@ public class PrepareBackupRequest extends CliLegacyMessage { @Override protected void process(DistributionMessage msg, boolean warn) { - if(msg instanceof PrepareBackupResponse) { - final HashSet<PersistentID> persistentIds = ((PrepareBackupResponse) msg).getPersistentIds(); - if(persistentIds != null && !persistentIds.isEmpty()) { + if (msg instanceof PrepareBackupResponse) { + final HashSet<PersistentID> persistentIds = + ((PrepareBackupResponse) msg).getPersistentIds(); + if (persistentIds != null && !persistentIds.isEmpty()) { results.put(msg.getSender(), persistentIds); } } super.process(msg, warn); } - - + + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java index 4368cce..2ba6817 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.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; @@ -34,16 +32,17 @@ import org.apache.geode.internal.admin.remote.AdminResponse; public class PrepareBackupResponse extends AdminResponse { private HashSet<PersistentID> persistentIds; - + public PrepareBackupResponse() { super(); } - public PrepareBackupResponse(InternalDistributedMember sender, HashSet<PersistentID> persistentIds) { + public PrepareBackupResponse(InternalDistributedMember sender, + HashSet<PersistentID> persistentIds) { this.setRecipient(sender); this.persistentIds = persistentIds; } - + public HashSet<PersistentID> getPersistentIds() { return persistentIds; } @@ -58,7 +57,7 @@ public class PrepareBackupResponse extends AdminResponse { @Override public void toData(DataOutput out) throws IOException { - super.toData(out); + super.toData(out); DataSerializer.writeHashSet(persistentIds, out); } @@ -73,7 +72,7 @@ public class PrepareBackupResponse extends AdminResponse { public int getDSFID() { return PREPARE_BACKUP_RESPONSE; } - + @Override public String toString() { return getClass().getName() + ": " + persistentIds; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticImpl.java index 987bdfa..517f0a0 100755 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticImpl.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; @@ -22,75 +20,73 @@ import org.apache.geode.internal.admin.Stat; /** * Implementation of a single statistic in a <code>StatisticResource</code> * - * @since GemFire 3.5 + * @since GemFire 3.5 * */ -public class StatisticImpl -implements org.apache.geode.admin.Statistic { +public class StatisticImpl implements org.apache.geode.admin.Statistic { private static final long serialVersionUID = 3899296873901634399L; - + private Stat internalStat; - protected StatisticImpl() { - } + protected StatisticImpl() {} protected StatisticImpl(Stat internalStat) { this.internalStat = internalStat; } - + /** - * @return the identifying name of this stat + * @return the identifying name of this stat */ public String getName() { return this.internalStat.getName(); } - + /** - * @return the value of this stat as a <code>java.lang.Number</code> + * @return the value of this stat as a <code>java.lang.Number</code> */ public Number getValue() { return this.internalStat.getValue(); } - + /** * @return a display string for the unit of measurement (if any) this stat represents */ public String getUnits() { return this.internalStat.getUnits(); } - + /** * @return true if this stat represents a numeric value which always increases */ public boolean isCounter() { return this.internalStat.isCounter(); } - + /** * @return the full description of this stat */ public String getDescription() { return this.internalStat.getDescription(); } - + /** - * Sets the internal stat which allows us to reuse the wrapper object and - * handle refreshes along with isWriteable set to false on the attribute. + * Sets the internal stat which allows us to reuse the wrapper object and handle refreshes along + * with isWriteable set to false on the attribute. */ protected void setStat(Stat internalStat) { this.internalStat = internalStat; } - - /** - * Returns a string representation of the object. - * - * @return a string representation of the object - */ + + /** + * Returns a string representation of the object. + * + * @return a string representation of the object + */ @Override - public String toString() { - return getName(); - } - + public String toString() { + return getName(); + } + } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticResourceImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticResourceImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticResourceImpl.java index 9458759..c6f60cb 100755 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticResourceImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/StatisticResourceImpl.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; @@ -23,19 +21,18 @@ import org.apache.geode.internal.Assert; import org.apache.geode.internal.admin.Stat; import org.apache.geode.internal.admin.StatResource; import org.apache.geode.internal.i18n.LocalizedStrings; -//import org.apache.geode.internal.admin.SystemMember; +// import org.apache.geode.internal.admin.SystemMember; import java.util.ArrayList; -//import java.util.Date; +// import java.util.Date; import java.util.List; /** * Provides monitoring of a statistic resource. * - * @since GemFire 3.5 + * @since GemFire 3.5 */ -public class StatisticResourceImpl -implements org.apache.geode.admin.StatisticResource { +public class StatisticResourceImpl implements org.apache.geode.admin.StatisticResource { /** The underlying remote StatResource which this object delegates to */ protected StatResource statResource; @@ -49,22 +46,21 @@ implements org.apache.geode.admin.StatisticResource { protected SystemMember member; /** The array of statistics in this resource */ protected Statistic[] statistics; // = new Statistic[0]; - + // ------------------------------------------------------------------------- - // Constructor(s) + // Constructor(s) // ------------------------------------------------------------------------- - + /** * Constructs an instance of StatisticResourceImpl. * - * @param statResource the admin StatResource to manage/monitor - * @param member the SystemMember owning this resource - * @exception org.apache.geode.admin.AdminException - * if unable to create this StatisticResource for administration + * @param statResource the admin StatResource to manage/monitor + * @param member the SystemMember owning this resource + * @exception org.apache.geode.admin.AdminException if unable to create this StatisticResource for + * administration */ - public StatisticResourceImpl(StatResource statResource, - SystemMember member) - throws org.apache.geode.admin.AdminException { + public StatisticResourceImpl(StatResource statResource, SystemMember member) + throws org.apache.geode.admin.AdminException { this.statResource = statResource; this.member = member; this.name = this.statResource.getName(); @@ -73,31 +69,30 @@ implements org.apache.geode.admin.StatisticResource { } // ------------------------------------------------------------------------- - // Attributes accessors and mutators + // Attributes accessors and mutators // ------------------------------------------------------------------------- - public String getName() { - return this.name; - } - - public String getDescription() { - return this.description; - } - + public String getName() { + return this.name; + } + + public String getDescription() { + return this.description; + } + public String getType() { return this.type; } - - public String getOwner() { - return this.member.toString(); - } - + + public String getOwner() { + return this.member.toString(); + } + public Statistic[] getStatistics() { if (this.statistics == null) { try { refresh(); - } - catch (AdminException e) { + } catch (AdminException e) { this.statistics = new Statistic[0]; } } @@ -107,9 +102,9 @@ implements org.apache.geode.admin.StatisticResource { public long getUniqueId() { return this.statResource.getResourceUniqueID(); } - + // ------------------------------------------------------------------------- - // Operations + // Operations // ------------------------------------------------------------------------- public void refresh() throws org.apache.geode.admin.AdminException { @@ -118,9 +113,11 @@ implements org.apache.geode.admin.StatisticResource { stats = this.statResource.getStats(); } if (stats == null || stats.length < 1) { - throw new AdminException(LocalizedStrings.StatisticResourceImpl_FAILED_TO_REFRESH_STATISTICS_0_FOR_1.toLocalizedString(getType()+"-"+getName(), getOwner())); + throw new AdminException( + LocalizedStrings.StatisticResourceImpl_FAILED_TO_REFRESH_STATISTICS_0_FOR_1 + .toLocalizedString(getType() + "-" + getName(), getOwner())); } - + if (this.statistics == null || this.statistics.length < 1) { // define new statistics instances... List statList = new ArrayList(); @@ -128,8 +125,7 @@ implements org.apache.geode.admin.StatisticResource { statList.add(createStatistic(stats[i])); } this.statistics = (Statistic[]) statList.toArray(new Statistic[0]); - } - else { + } else { // update the existing instances... for (int i = 0; i < stats.length; i++) { updateStatistic(stats[i]); @@ -138,44 +134,44 @@ implements org.apache.geode.admin.StatisticResource { } // ------------------------------------------------------------------------- - // Non-public implementation methods + // Non-public implementation methods // ------------------------------------------------------------------------- - + /** - * Updates the value of the {@link Statistic} corresponding to the internal + * Updates the value of the {@link Statistic} corresponding to the internal * {@link org.apache.geode.internal.admin.Stat} * - * @param stat the internal stat to use in updating the matching statistic + * @param stat the internal stat to use in updating the matching statistic */ private void updateStatistic(Stat stat) { for (int i = 0; i < this.statistics.length; i++) { if (this.statistics[i].getName().equals(stat.getName())) { - ((StatisticImpl)this.statistics[i]).setStat(stat); + ((StatisticImpl) this.statistics[i]).setStat(stat); return; } } Assert.assertTrue(false, "Unknown stat: " + stat.getName()); } - + /** - * Creates a new {@link StatisticImpl} to represent the internal {@link - * org.apache.geode.internal.admin.Stat} + * Creates a new {@link StatisticImpl} to represent the internal + * {@link org.apache.geode.internal.admin.Stat} * - * @param stat the internal stat to wrap in a new statistic + * @param stat the internal stat to wrap in a new statistic */ protected Statistic createStatistic(Stat stat) { return new StatisticImpl(stat); } - - /** - * Returns a string representation of the object. - * - * @return a string representation of the object - */ + + /** + * Returns a string representation of the object. + * + * @return a string representation of the object + */ @Override - public String toString() { - return getName(); - } - + public String toString() { + return getName(); + } + } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberBridgeServerImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberBridgeServerImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberBridgeServerImpl.java index 546983c..4e530ef 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberBridgeServerImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberBridgeServerImpl.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; @@ -32,7 +30,7 @@ import org.apache.geode.internal.i18n.LocalizedStrings; * @since GemFire 4.0 */ public class SystemMemberBridgeServerImpl - implements SystemMemberCacheServer, SystemMemberBridgeServer { + implements SystemMemberCacheServer, SystemMemberBridgeServer { /** The VM in which the bridge server resides */ private final GemFireVM vm; @@ -43,31 +41,31 @@ public class SystemMemberBridgeServerImpl /** Information about the bridge server */ private AdminBridgeServer bridgeInfo; - ///////////////////// Constructors ///////////////////// + ///////////////////// Constructors ///////////////////// /** - * Creates a new <code>SystemMemberBridgeServerImpl</code> that - * administers the given bridge server in the given VM. + * Creates a new <code>SystemMemberBridgeServerImpl</code> that administers the given bridge + * server in the given VM. */ - protected SystemMemberBridgeServerImpl(SystemMemberCacheImpl cache, - AdminBridgeServer bridgeInfo) - - throws AdminException { + protected SystemMemberBridgeServerImpl(SystemMemberCacheImpl cache, AdminBridgeServer bridgeInfo) + + throws AdminException { this.vm = cache.getVM(); this.cache = cache.getCacheInfo(); this.bridgeInfo = bridgeInfo; } - //////////////////// Instance Methods //////////////////// + //////////////////// Instance Methods //////////////////// /** - * Throws an <code>AdminException</code> if this bridge server is - * running. + * Throws an <code>AdminException</code> if this bridge server is running. */ private void checkRunning() throws AdminException { if (this.isRunning()) { - throw new AdminException(LocalizedStrings.SystemMemberBridgeServerImpl_CANNOT_CHANGE_THE_CONFIGURATION_OF_A_RUNNING_BRIDGE_SERVER.toLocalizedString()); + throw new AdminException( + LocalizedStrings.SystemMemberBridgeServerImpl_CANNOT_CHANGE_THE_CONFIGURATION_OF_A_RUNNING_BRIDGE_SERVER + .toLocalizedString()); } } @@ -101,11 +99,13 @@ public class SystemMemberBridgeServerImpl public void refresh() { try { - this.bridgeInfo = - this.vm.getBridgeInfo(this.cache, this.bridgeInfo.getId()); + this.bridgeInfo = this.vm.getBridgeInfo(this.cache, this.bridgeInfo.getId()); } catch (AdminException ex) { - throw new InternalGemFireException(LocalizedStrings.SystemMemberBridgeServerImpl_UNEXPECTED_EXCEPTION_WHILE_REFRESHING.toLocalizedString(), ex); + throw new InternalGemFireException( + LocalizedStrings.SystemMemberBridgeServerImpl_UNEXPECTED_EXCEPTION_WHILE_REFRESHING + .toLocalizedString(), + ex); } } @@ -144,12 +144,12 @@ public class SystemMemberBridgeServerImpl public int getSocketBufferSize() { return this.bridgeInfo.getSocketBufferSize(); } - + public void setTcpDelay(boolean setting) throws AdminException { checkRunning(); this.bridgeInfo.setTcpNoDelay(setting); } - + public boolean getTcpDelay() { return this.bridgeInfo.getTcpNoDelay(); } @@ -207,15 +207,16 @@ public class SystemMemberBridgeServerImpl public String[] getGroups() { return this.bridgeInfo.getGroups(); } - + public String getLoadProbe() { return this.bridgeInfo.getLoadProbe().toString(); } public void setLoadProbe(ServerLoadProbe loadProbe) throws AdminException { checkRunning(); - if(!(loadProbe instanceof Serializable)) { - throw new IllegalArgumentException("Load probe must be Serializable to be used with admin API"); + if (!(loadProbe instanceof Serializable)) { + throw new IllegalArgumentException( + "Load probe must be Serializable to be used with admin API"); } this.bridgeInfo.setLoadProbe(loadProbe); } @@ -228,6 +229,6 @@ public class SystemMemberBridgeServerImpl checkRunning(); this.bridgeInfo.setLoadPollInterval(loadPollInterval); } - - + + } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventImpl.java index e4f7e60..b6b386e 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventImpl.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; @@ -21,32 +19,28 @@ import org.apache.geode.distributed.DistributedMember; import org.apache.geode.cache.Operation; /** - * An event that describes an operation on a cache. - * Instances of this are delivered to a {@link SystemMemberCacheListener} when a - * a cache is created or closed. + * An event that describes an operation on a cache. Instances of this are delivered to a + * {@link SystemMemberCacheListener} when a a cache is created or closed. * * @since GemFire 5.0 */ -public class SystemMemberCacheEventImpl - extends SystemMembershipEventImpl - implements SystemMemberCacheEvent -{ +public class SystemMemberCacheEventImpl extends SystemMembershipEventImpl + implements SystemMemberCacheEvent { /** The operation done by this event */ private Operation op; - /////////////////////// Constructors /////////////////////// + /////////////////////// Constructors /////////////////////// /** - * Creates a new <code>SystemMemberCacheEvent</code> for the member - * with the given id. + * Creates a new <code>SystemMemberCacheEvent</code> for the member with the given id. */ protected SystemMemberCacheEventImpl(DistributedMember id, Operation op) { super(id); this.op = op; } - ///////////////////// Instance Methods ///////////////////// + ///////////////////// Instance Methods ///////////////////// public Operation getOperation() { return this.op; http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventProcessor.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventProcessor.java b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventProcessor.java index 43f9b89..8afafdb 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventProcessor.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheEventProcessor.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; @@ -38,14 +36,15 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem; import org.apache.geode.internal.logging.LogService; /** - * This class processes the message to be delivered to admin node. - * [This needs to be redesigned and reimplemented... see 32887] + * This class processes the message to be delivered to admin node. [This needs to be redesigned and + * reimplemented... see 32887] + * * @since GemFire 5.0 */ public class SystemMemberCacheEventProcessor { private static final Logger logger = LogService.getLogger(); - + /* * Sends cache create/close message to Admin VMs */ @@ -57,7 +56,7 @@ public class SystemMemberCacheEventProcessor { * Sends region creation/destroy message to Admin VMs */ public static void send(Cache c, Region region, Operation op) { - InternalDistributedSystem system = (InternalDistributedSystem)c.getDistributedSystem(); + InternalDistributedSystem system = (InternalDistributedSystem) c.getDistributedSystem(); Set recps = system.getDistributionManager().getAdminMemberSet(); // @todo darrel: find out if any of these guys have region listeners if (recps.isEmpty()) { @@ -73,10 +72,9 @@ public class SystemMemberCacheEventProcessor { msg.op = op; system.getDistributionManager().putOutgoing(msg); } - - - public static final class SystemMemberCacheMessage extends HighPriorityDistributionMessage - { + + + public static final class SystemMemberCacheMessage extends HighPriorityDistributionMessage { protected String regionPath; protected Operation op; @@ -85,15 +83,16 @@ public class SystemMemberCacheEventProcessor { AdminDistributedSystemImpl admin = AdminDistributedSystemImpl.getConnectedInstance(); if (admin == null) { if (logger.isDebugEnabled()) { - logger.debug("Ignoring message because there is no admin distributed system present: {}", this); + logger.debug("Ignoring message because there is no admin distributed system present: {}", + this); } - return; // probably shutting down or still connecting + return; // probably shutting down or still connecting } List listeners = admin.getCacheListeners(); Iterator itr = listeners.iterator(); SystemMemberCacheListener listener = null; - while(itr.hasNext()){ - listener = (SystemMemberCacheListener)itr.next(); + while (itr.hasNext()) { + listener = (SystemMemberCacheListener) itr.next(); if (this.regionPath == null) { SystemMemberCacheEvent event = new SystemMemberCacheEventImpl(getSender(), this.op); if (this.op == Operation.CACHE_CREATE) { @@ -102,7 +101,8 @@ public class SystemMemberCacheEventProcessor { listener.afterCacheClose(event); } } else { - SystemMemberRegionEvent event = new SystemMemberRegionEventImpl(getSender(), this.op, this.regionPath); + SystemMemberRegionEvent event = + new SystemMemberRegionEventImpl(getSender(), this.op, this.regionPath); if (this.op.isRegionDestroy()) { listener.afterRegionLoss(event); } else { @@ -117,8 +117,7 @@ public class SystemMemberCacheEventProcessor { } @Override - public void fromData(DataInput in) - throws IOException, ClassNotFoundException { + public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); this.regionPath = DataSerializer.readString(in); this.op = Operation.fromOrdinal(in.readByte()); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheImpl.java index 7c1ba71..62076f0 100644 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberCacheImpl.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,28 +26,28 @@ import java.util.*; /** * View of a GemFire system member's cache. * - * @since GemFire 3.5 + * @since GemFire 3.5 */ public class SystemMemberCacheImpl implements SystemMemberCache { protected final GemFireVM vm; protected CacheInfo info; protected Statistic[] statistics; - /** Maps the id of a bridge server to its SystemMemberBridgeServer */ + /** Maps the id of a bridge server to its SystemMemberBridgeServer */ private ObjIdMap bridgeServers = new ObjIdMap(); - + // constructors - public SystemMemberCacheImpl(GemFireVM vm) - throws CacheDoesNotExistException - { + public SystemMemberCacheImpl(GemFireVM vm) throws CacheDoesNotExistException { this.vm = vm; this.info = vm.getCacheInfo(); if (this.info == null) { - throw new CacheDoesNotExistException(LocalizedStrings.SystemMemberCacheImpl_THE_VM_0_DOES_NOT_CURRENTLY_HAVE_A_CACHE.toLocalizedString(vm.getId())); + throw new CacheDoesNotExistException( + LocalizedStrings.SystemMemberCacheImpl_THE_VM_0_DOES_NOT_CURRENTLY_HAVE_A_CACHE + .toLocalizedString(vm.getId())); } initStats(); } - + // attributes /** * The name of the cache. @@ -61,6 +59,7 @@ public class SystemMemberCacheImpl implements SystemMemberCache { } return result; } + /** * Value that uniquely identifies an instance of a cache for a given member. */ @@ -71,27 +70,35 @@ public class SystemMemberCacheImpl implements SystemMemberCache { public boolean isClosed() { return this.info.isClosed(); } + public int getLockTimeout() { return this.info.getLockTimeout(); } + public void setLockTimeout(int seconds) throws AdminException { this.info = this.vm.setCacheLockTimeout(this.info, seconds); } + public int getLockLease() { return this.info.getLockLease(); } + public void setLockLease(int seconds) throws AdminException { this.info = this.vm.setCacheLockLease(this.info, seconds); } + public int getSearchTimeout() { return this.info.getSearchTimeout(); } + public void setSearchTimeout(int seconds) throws AdminException { this.info = this.vm.setCacheSearchTimeout(this.info, seconds); } + public int getUpTime() { return this.info.getUpTime(); } + public java.util.Set getRootRegionNames() { Set set = this.info.getRootRegionNames(); if (set == null) { @@ -115,29 +122,25 @@ public class SystemMemberCacheImpl implements SystemMemberCache { } } - public GemFireMemberStatus getSnapshot() - { - //System.out.println(">>>SystemMemberCacheJmxImpl::getSnapshot:pre::: " + this.vm); - GemFireMemberStatus stat = this.vm.getSnapshot(); - //System.out.println(">>>SystemMemberCacheJmxImpl::getSnapshot:post::: " + stat); - return stat; + public GemFireMemberStatus getSnapshot() { + // System.out.println(">>>SystemMemberCacheJmxImpl::getSnapshot:pre::: " + this.vm); + GemFireMemberStatus stat = this.vm.getSnapshot(); + // System.out.println(">>>SystemMemberCacheJmxImpl::getSnapshot:post::: " + stat); + return stat; } - public RegionSubRegionSnapshot getRegionSnapshot() - { - //System.out.println(">>>SystemMemberCacheJmxImpl::getRegionSnapshot:pre::: " + this.vm); - RegionSubRegionSnapshot snap = this.vm.getRegionSnapshot(); - //System.out.println(">>>SystemMemberCacheJmxImpl::getRegionSnapshot:post::: " + snap); - return snap; + public RegionSubRegionSnapshot getRegionSnapshot() { + // System.out.println(">>>SystemMemberCacheJmxImpl::getRegionSnapshot:pre::: " + this.vm); + RegionSubRegionSnapshot snap = this.vm.getRegionSnapshot(); + // System.out.println(">>>SystemMemberCacheJmxImpl::getRegionSnapshot:post::: " + snap); + return snap; } - + public Statistic[] getStatistics() { return this.statistics; } - public SystemMemberRegion getRegion(String path) - throws org.apache.geode.admin.AdminException - { + public SystemMemberRegion getRegion(String path) throws org.apache.geode.admin.AdminException { Region r = this.vm.getRegion(this.info, path); if (r == null) { return null; @@ -146,10 +149,8 @@ public class SystemMemberCacheImpl implements SystemMemberCache { } } - public SystemMemberRegion createRegion(String name, - RegionAttributes attrs) - throws AdminException - { + public SystemMemberRegion createRegion(String name, RegionAttributes attrs) + throws AdminException { Region r = this.vm.createVMRootRegion(this.info, name, attrs); if (r == null) { return null; @@ -158,11 +159,9 @@ public class SystemMemberCacheImpl implements SystemMemberCache { return createSystemMemberRegion(r); } } - - public SystemMemberRegion createVMRegion(String name, - RegionAttributes attrs) - throws AdminException - { + + public SystemMemberRegion createVMRegion(String name, RegionAttributes attrs) + throws AdminException { return createRegion(name, attrs); } @@ -181,7 +180,7 @@ public class SystemMemberCacheImpl implements SystemMemberCache { this.statistics = new Statistic[0]; return; } - + // define new statistics instances... List statList = new ArrayList(); for (int i = 0; i < stats.length; i++) { @@ -189,6 +188,7 @@ public class SystemMemberCacheImpl implements SystemMemberCache { } this.statistics = (Statistic[]) statList.toArray(new Statistic[statList.size()]); } + private void updateStats() { StatResource resource = this.info.getPerfStats(); if (resource == null) { @@ -201,7 +201,7 @@ public class SystemMemberCacheImpl implements SystemMemberCache { if (stats == null || stats.length < 1) { return; } - + for (int i = 0; i < stats.length; i++) { updateStatistic(stats[i]); } @@ -210,7 +210,7 @@ public class SystemMemberCacheImpl implements SystemMemberCache { private void updateStatistic(Stat stat) { for (int i = 0; i < this.statistics.length; i++) { if (this.statistics[i].getName().equals(stat.getName())) { - ((StatisticImpl)this.statistics[i]).setStat(stat); + ((StatisticImpl) this.statistics[i]).setStat(stat); return; } } @@ -218,9 +218,8 @@ public class SystemMemberCacheImpl implements SystemMemberCache { } /** - * Returns the <code>CacheInfo</code> that describes this cache. - * Note that this operation does not {@link #refresh} the - * <code>CacheInfo</code>. + * Returns the <code>CacheInfo</code> that describes this cache. Note that this operation does not + * {@link #refresh} the <code>CacheInfo</code>. */ public CacheInfo getCacheInfo() { return this.info; @@ -233,33 +232,29 @@ public class SystemMemberCacheImpl implements SystemMemberCache { protected Statistic createStatistic(Stat stat) { return new StatisticImpl(stat); } + protected SystemMemberRegion createSystemMemberRegion(Region r) - throws org.apache.geode.admin.AdminException - { + throws org.apache.geode.admin.AdminException { SystemMemberRegionImpl sysMemberRegion = new SystemMemberRegionImpl(this, r); sysMemberRegion.refresh(); return sysMemberRegion; } - public SystemMemberCacheServer addCacheServer() - throws AdminException { + public SystemMemberCacheServer addCacheServer() throws AdminException { AdminBridgeServer bridge = this.vm.addCacheServer(this.info); - SystemMemberCacheServer admin = - createSystemMemberBridgeServer(bridge); + SystemMemberCacheServer admin = createSystemMemberBridgeServer(bridge); bridgeServers.put(bridge.getId(), admin); return admin; } - private Collection getCacheServersCollection() - throws AdminException { + private Collection getCacheServersCollection() throws AdminException { Collection bridges = new ArrayList(); int[] bridgeIds = this.info.getBridgeServerIds(); for (int i = 0; i < bridgeIds.length; i++) { int id = bridgeIds[i]; - SystemMemberBridgeServer bridge = - (SystemMemberBridgeServer) bridgeServers.get(id); + SystemMemberBridgeServer bridge = (SystemMemberBridgeServer) bridgeServers.get(id); if (bridge == null) { AdminBridgeServer info = this.vm.getBridgeInfo(this.info, id); if (info != null) { @@ -275,21 +270,17 @@ public class SystemMemberCacheImpl implements SystemMemberCache { return bridges; } - public SystemMemberCacheServer[] getCacheServers() - throws AdminException { + public SystemMemberCacheServer[] getCacheServers() throws AdminException { Collection bridges = getCacheServersCollection(); - SystemMemberCacheServer[] array = - new SystemMemberCacheServer[bridges.size()]; + SystemMemberCacheServer[] array = new SystemMemberCacheServer[bridges.size()]; return (SystemMemberCacheServer[]) bridges.toArray(array); }; /** - * Creates a new instance of <Code>SystemMemberBridgeServer</code> - * with the given configuration. + * Creates a new instance of <Code>SystemMemberBridgeServer</code> with the given configuration. */ - protected SystemMemberBridgeServerImpl - createSystemMemberBridgeServer(AdminBridgeServer bridge) - throws AdminException { + protected SystemMemberBridgeServerImpl createSystemMemberBridgeServer(AdminBridgeServer bridge) + throws AdminException { return new SystemMemberBridgeServerImpl(this, bridge); } @@ -297,8 +288,8 @@ public class SystemMemberCacheImpl implements SystemMemberCache { public boolean isServer() throws AdminException { return this.info.isServer(); } - - + + /** * Returns a string representation of the object. * @@ -306,7 +297,7 @@ public class SystemMemberCacheImpl implements SystemMemberCache { */ @Override public String toString() { - return getName(); + return getName(); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberImpl.java index 57db801..1e2d2a7 100755 --- a/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberImpl.java +++ b/geode-core/src/main/java/org/apache/geode/admin/internal/SystemMemberImpl.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; @@ -38,17 +36,16 @@ import java.util.*; /** * Member of a GemFire system. * - * @since GemFire 3.5 + * @since GemFire 3.5 */ -public class SystemMemberImpl -implements org.apache.geode.admin.SystemMember, - org.apache.geode.admin.internal.ConfigurationParameterListener { +public class SystemMemberImpl implements org.apache.geode.admin.SystemMember, + org.apache.geode.admin.internal.ConfigurationParameterListener { private static final Logger logger = LogService.getLogger(); - - /** Identifying name of this member. - * Note that by default this is the string form of internalId but the - * ManagedSystemMemberImpl subclass resets it to getNewId() + + /** + * Identifying name of this member. Note that by default this is the string form of internalId but + * the ManagedSystemMemberImpl subclass resets it to getNewId() */ protected String id; @@ -62,10 +59,12 @@ implements org.apache.geode.admin.SystemMember, protected String host; /** The internal configuration this impl delegates to for runtime config */ -// private Config config; + // private Config config; - /** The configuration parameters for this member. Maps the name of - the ConfigurationParameter to the ConfigurationParameter. */ + /** + * The configuration parameters for this member. Maps the name of the ConfigurationParameter to + * the ConfigurationParameter. + */ protected Map parms = new HashMap(); /** The {@link AdminDistributedSystem} this is a member of */ @@ -73,69 +72,60 @@ implements org.apache.geode.admin.SystemMember, /** Internal GemFire vm to delegate to */ private GemFireVM vm; - + // ------------------------------------------------------------------------- - // Constructor(s) + // Constructor(s) // ------------------------------------------------------------------------- - /** - * Constructs new <code>SystemMemberImpl</code> for a - * <code>ManagedEntity</code> that has yet to be started. + /** + * Constructs new <code>SystemMemberImpl</code> for a <code>ManagedEntity</code> that has yet to + * be started. * - * @param system the distributed system this member belongs to + * @param system the distributed system this member belongs to */ - protected SystemMemberImpl(AdminDistributedSystem system) - throws AdminException { + protected SystemMemberImpl(AdminDistributedSystem system) throws AdminException { this.system = system; refreshConfig(getDefaultConfig()); } - /** - * Constructs new <code>SystemMemberImpl</code> from the given - * <code>GemFireVM</code>. This constructor is invoked when we - * discover a new member of the distributed system. + /** + * Constructs new <code>SystemMemberImpl</code> from the given <code>GemFireVM</code>. This + * constructor is invoked when we discover a new member of the distributed system. * - * @param system the distributed system this member belongs to + * @param system the distributed system this member belongs to * @param vm internal GemFire vm to delegate to */ - public SystemMemberImpl(AdminDistributedSystem system, - GemFireVM vm) - throws AdminException { + public SystemMemberImpl(AdminDistributedSystem system, GemFireVM vm) throws AdminException { this(system); setGemFireVM(vm); } /** - * Constructs the instance of SystemMember using the corresponding - * InternalDistributedMember instance of a DS member for the given - * AdminDistributedSystem. + * Constructs the instance of SystemMember using the corresponding InternalDistributedMember + * instance of a DS member for the given AdminDistributedSystem. + * + * @param system Current AdminDistributedSystem instance + * @param member InternalDistributedMember instance for which a SystemMember instance is to be + * constructed. + * @throws AdminException if construction of SystemMember fails * - * @param system - * Current AdminDistributedSystem instance - * @param member - * InternalDistributedMember instance for which a SystemMember - * instance is to be constructed. - * @throws AdminException - * if construction of SystemMember fails - * * @since GemFire 6.5 */ - protected SystemMemberImpl(AdminDistributedSystem system, - InternalDistributedMember member) - throws AdminException { + protected SystemMemberImpl(AdminDistributedSystem system, InternalDistributedMember member) + throws AdminException { this(system); updateByInternalDistributedMember(member); } // ------------------------------------------------------------------------- - // Attribute accessors and mutators + // Attribute accessors and mutators // ------------------------------------------------------------------------- /** - * Returns a <code>Config</code> object with the appropriate default - * values for a newly-created system member. + * Returns a <code>Config</code> object with the appropriate default values for a newly-created + * system member. */ protected Config getDefaultConfig() { Properties props = new Properties(); @@ -145,7 +135,7 @@ implements org.apache.geode.admin.SystemMember, public final AdminDistributedSystem getDistributedSystem() { return this.system; } - + public final InternalDistributedMember getInternalId() { return internalId; } @@ -157,39 +147,42 @@ implements org.apache.geode.admin.SystemMember, public final String getName() { return this.name; } - + public String getHost() { return this.host; } - + public final InetAddress getHostAddress() { return InetAddressUtil.toInetAddress(this.getHost()); } // ------------------------------------------------------------------------- - // Operations + // Operations // ------------------------------------------------------------------------- - + public final String getLog() { String childTail = null; String mainTail = null; GemFireVM vm = getGemFireVM(); if (vm != null) { String[] log = vm.getSystemLogs(); - if (log != null && log.length > 0) mainTail = log[0]; - if (log != null && log.length > 1) childTail = log[1]; + if (log != null && log.length > 0) + mainTail = log[0]; + if (log != null && log.length > 1) + childTail = log[1]; } - + if (childTail == null && mainTail == null) { - return LocalizedStrings.SystemMemberImpl_NO_LOG_FILE_CONFIGURED_LOG_MESSAGES_WILL_BE_DIRECTED_TO_STDOUT.toLocalizedString(); - } - else { + return LocalizedStrings.SystemMemberImpl_NO_LOG_FILE_CONFIGURED_LOG_MESSAGES_WILL_BE_DIRECTED_TO_STDOUT + .toLocalizedString(); + } else { StringBuffer result = new StringBuffer(); if (mainTail != null) { result.append(mainTail); } if (childTail != null) { - result.append("\n" + LocalizedStrings.SystemMemberImpl_TAIL_OF_CHILD_LOG.toLocalizedString() + "\n"); + result.append( + "\n" + LocalizedStrings.SystemMemberImpl_TAIL_OF_CHILD_LOG.toLocalizedString() + "\n"); result.append(childTail); } return result.toString(); @@ -198,27 +191,28 @@ implements org.apache.geode.admin.SystemMember, public final java.util.Properties getLicense() { GemFireVM vm = getGemFireVM(); - if (vm == null) return null; + if (vm == null) + return null; return new Properties(); } public final String getVersion() { GemFireVM vm = getGemFireVM(); - if (vm == null) return null; + if (vm == null) + return null; return vm.getVersionInfo(); } - public StatisticResource[] getStat(String statisticsTypeName) - throws org.apache.geode.admin.AdminException { + public StatisticResource[] getStat(String statisticsTypeName) + throws org.apache.geode.admin.AdminException { StatisticResource[] res = new StatisticResource[0]; if (this.vm != null) { res = getStatsImpl(this.vm.getStats(statisticsTypeName)); } - return res.length==0 ? null : res; + return res.length == 0 ? null : res; } - public StatisticResource[] getStats() - throws org.apache.geode.admin.AdminException { + public StatisticResource[] getStats() throws org.apache.geode.admin.AdminException { StatisticResource[] statsImpl = new StatisticResource[0]; if (this.vm != null) { statsImpl = getStatsImpl(this.vm.getStats(null)); @@ -236,11 +230,10 @@ implements org.apache.geode.admin.SystemMember, } } - public final SystemMemberCache getCache() - throws org.apache.geode.admin.AdminException - { + public final SystemMemberCache getCache() throws org.apache.geode.admin.AdminException { GemFireVM vm = getGemFireVM(); // fix for bug 33505 - if (vm == null) return null; + if (vm == null) + return null; try { return createSystemMemberCache(vm); @@ -251,55 +244,55 @@ implements org.apache.geode.admin.SystemMember, return null; } } - - public void refreshConfig() - throws org.apache.geode.admin.AdminException { + + public void refreshConfig() throws org.apache.geode.admin.AdminException { GemFireVM vm = getGemFireVM(); - if (vm == null) return; + if (vm == null) + return; refreshConfig(vm.getConfig()); } - + /** - * Sets the value of this system member's distribution-related - * configuration based on the given <code>Config</code> object. + * Sets the value of this system member's distribution-related configuration based on the given + * <code>Config</code> object. */ - public final void refreshConfig(Config config) - throws org.apache.geode.admin.AdminException { + public final void refreshConfig(Config config) throws org.apache.geode.admin.AdminException { if (config == null) { - throw new AdminException(LocalizedStrings.SystemMemberImpl_FAILED_TO_REFRESH_CONFIGURATION_PARAMETERS_FOR_0.toLocalizedString(new Object[] {getId()})); + throw new AdminException( + LocalizedStrings.SystemMemberImpl_FAILED_TO_REFRESH_CONFIGURATION_PARAMETERS_FOR_0 + .toLocalizedString(new Object[] {getId()})); } - + String[] names = config.getAttributeNames(); if (names == null || names.length < 1) { - throw new AdminException(LocalizedStrings.SystemMemberImpl_FAILED_TO_REFRESH_CONFIGURATION_PARAMETERS_FOR_0.toLocalizedString(new Object[] {getId()})); + throw new AdminException( + LocalizedStrings.SystemMemberImpl_FAILED_TO_REFRESH_CONFIGURATION_PARAMETERS_FOR_0 + .toLocalizedString(new Object[] {getId()})); } - + for (int i = 0; i < names.length; i++) { String name = names[i]; Object value = config.getAttributeObject(name); if (value != null) { - ConfigurationParameter parm = createConfigurationParameter( - name, // name - config.getAttributeDescription(name), // description - value, // value - config.getAttributeType(name), // valueType - config.isAttributeModifiable(name) ); // isModifiable + ConfigurationParameter parm = createConfigurationParameter(name, // name + config.getAttributeDescription(name), // description + value, // value + config.getAttributeType(name), // valueType + config.isAttributeModifiable(name)); // isModifiable ((ConfigurationParameterImpl) parm).addConfigurationParameterListener(this); this.parms.put(name, parm); } } } - + public final ConfigurationParameter[] getConfiguration() { - ConfigurationParameter[] array = - new ConfigurationParameter[this.parms.size()]; + ConfigurationParameter[] array = new ConfigurationParameter[this.parms.size()]; this.parms.values().toArray(array); return array; } - - public ConfigurationParameter[] - setConfiguration(ConfigurationParameter[] parms) - throws AdminException { + + public ConfigurationParameter[] setConfiguration(ConfigurationParameter[] parms) + throws AdminException { for (int i = 0; i < parms.length; i++) { ConfigurationParameter parm = parms[i]; @@ -308,7 +301,7 @@ implements org.apache.geode.admin.SystemMember, GemFireVM vm = getGemFireVM(); if (vm != null) { - // update internal vm's config... + // update internal vm's config... Config config = vm.getConfig(); for (int i = 0; i < parms.length; i++) { config.setAttributeObject(parms[i].getName(), parms[i].getValue(), ConfigSource.runtime()); @@ -318,19 +311,19 @@ implements org.apache.geode.admin.SystemMember, return this.getConfiguration(); } - + public SystemMemberType getType() { return SystemMemberType.APPLICATION; } - + // ------------------------------------------------------------------------- - // Listener callbacks + // Listener callbacks // ------------------------------------------------------------------------- - + // -- org.apache.geode.admin.internal.ConfigurationParameterListener --- public void configurationParameterValueChanged(ConfigurationParameter parm) { try { - setConfiguration(new ConfigurationParameter[] { parm }); + setConfiguration(new ConfigurationParameter[] {parm}); } catch (org.apache.geode.admin.AdminException e) { // this shouldn't occur since this is a config listener method... logger.warn(e.getMessage(), e); @@ -338,18 +331,18 @@ implements org.apache.geode.admin.SystemMember, } catch (java.lang.Exception e) { logger.warn(e.getMessage(), e); } -// catch (java.lang.RuntimeException e) { -// logWriter.warning(e); -// throw e; -// } + // catch (java.lang.RuntimeException e) { + // logWriter.warning(e); + // throw e; + // } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); - // If this ever returns, rethrow the error. We're poisoned + // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } catch (java.lang.Error e) { // Whenever you catch Error or Throwable, you must also - // catch VirtualMachineError (see above). However, there is + // catch VirtualMachineError (see above). However, there is // _still_ a possibility that you are dealing with a cascading // error condition, so you also need to check to see if the JVM // is still usable: @@ -358,32 +351,30 @@ implements org.apache.geode.admin.SystemMember, throw e; } } - + // ------------------------------------------------------------------------- - // Overridden method(s) from java.lang.Object + // Overridden method(s) from java.lang.Object // ------------------------------------------------------------------------- - + @Override public String toString() { return getName(); } - + // ------------------------------------------------------------------------- - // Template methods with default behavior impl'ed. Override if needed. + // Template methods with default behavior impl'ed. Override if needed. // ------------------------------------------------------------------------- - + /** - * Returns the <code>GemFireVM</code> that underlies this - * <code>SystemMember</code>. + * Returns the <code>GemFireVM</code> that underlies this <code>SystemMember</code>. */ protected final GemFireVM getGemFireVM() { return this.vm; } /** - * Sets the <code>GemFireVM</code> that underlies this - * <code>SystemMember</code>. This method is used when a member, - * such as a cache server, is started by the admin API. + * Sets the <code>GemFireVM</code> that underlies this <code>SystemMember</code>. This method is + * used when a member, such as a cache server, is started by the admin API. */ void setGemFireVM(GemFireVM vm) throws AdminException { this.vm = vm; @@ -410,23 +401,19 @@ implements org.apache.geode.admin.SystemMember, } /** - * Updates this SystemMember instance using the corresponding - * InternalDistributedMember + * Updates this SystemMember instance using the corresponding InternalDistributedMember + * + * @param member InternalDistributedMember instance to update this SystemMember * - * @param member - * InternalDistributedMember instance to update this SystemMember - * * @since GemFire 6.5 */ - private void updateByInternalDistributedMember( - InternalDistributedMember member) { + private void updateByInternalDistributedMember(InternalDistributedMember member) { if (member != null) { this.internalId = member; - this.id = this.internalId.toString(); - this.host = this.internalId.getHost(); - this.name = this.internalId.getName(); - if (this.name == null || - DistributionConfig.DEFAULT_NAME.equals(this.name)) { + this.id = this.internalId.toString(); + this.host = this.internalId.getHost(); + this.name = this.internalId.getName(); + if (this.name == null || DistributionConfig.DEFAULT_NAME.equals(this.name)) { /* * name could be null & referring to description of a fix for 32877 */ @@ -434,52 +421,47 @@ implements org.apache.geode.admin.SystemMember, } } } - + /** * Template method for creating {@link StatisticResource}. * - * @param stat the internal stat resource to wrap with {@link StatisticResource} + * @param stat the internal stat resource to wrap with {@link StatisticResource} * @return new impl instance of {@link StatisticResource} */ protected StatisticResource createStatisticResource(StatResource stat) - throws org.apache.geode.admin.AdminException { + throws org.apache.geode.admin.AdminException { return new StatisticResourceImpl(stat, this); } - + /** * Template method for creating {@link ConfigurationParameter}. * - * @param name the name of this parameter which cannot change - * @param description full description to use - * @param value the value of this parameter - * @param type the class type of the value - * @param userModifiable true if this is modifiable; false if read-only + * @param name the name of this parameter which cannot change + * @param description full description to use + * @param value the value of this parameter + * @param type the class type of the value + * @param userModifiable true if this is modifiable; false if read-only * @return new impl instance of {@link ConfigurationParameter} */ - protected ConfigurationParameter createConfigurationParameter(String name, - String description, - Object value, - Class type, - boolean userModifiable) { - return new ConfigurationParameterImpl( - name, description, value, type, userModifiable); - } - + protected ConfigurationParameter createConfigurationParameter(String name, String description, + Object value, Class type, boolean userModifiable) { + return new ConfigurationParameterImpl(name, description, value, type, userModifiable); + } + /** * Template method for creating {@link SystemMemberCache}. * - * @param vm the GemFire vm to retrieve cache info from + * @param vm the GemFire vm to retrieve cache info from * @return new impl instance of {@link SystemMemberCache} */ protected SystemMemberCache createSystemMemberCache(GemFireVM vm) - throws org.apache.geode.admin.AdminException - { + throws org.apache.geode.admin.AdminException { return new SystemMemberCacheImpl(vm); } /** Wrap the internal stats with impls of {@link StatisticResource} */ protected StatisticResource[] getStatsImpl(StatResource[] stats) - throws org.apache.geode.admin.AdminException { + throws org.apache.geode.admin.AdminException { List statList = new ArrayList(); for (int i = 0; i < stats.length; i++) { statList.add(createStatisticResource(stats[i])); @@ -497,9 +479,9 @@ implements org.apache.geode.admin.SystemMember, } return roleNames; } - + public DistributedMember getDistributedMember() { - return this.internalId; + return this.internalId; } }
