Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C063F18F41 for ; Tue, 16 Feb 2016 16:07:03 +0000 (UTC) Received: (qmail 84349 invoked by uid 500); 16 Feb 2016 16:07:03 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 84316 invoked by uid 500); 16 Feb 2016 16:07:03 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 84307 invoked by uid 99); 16 Feb 2016 16:07:03 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2016 16:07:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 1FDFDC0887 for ; Tue, 16 Feb 2016 16:07:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.143 X-Spam-Level: X-Spam-Status: No, score=-3.143 tagged_above=-999 required=6.31 tests=[FILL_THIS_FORM_FRAUD_PHISH=0.396, KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.329, T_FILL_THIS_FORM_SHORT=0.01] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id i418VvgIhN3K for ; Tue, 16 Feb 2016 16:06:51 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 6D17C5FB18 for ; Tue, 16 Feb 2016 16:06:50 +0000 (UTC) Received: (qmail 84131 invoked by uid 99); 16 Feb 2016 16:06:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Feb 2016 16:06:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A0AA5E057C; Tue, 16 Feb 2016 16:06:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jinmeiliao@apache.org To: commits@geode.incubator.apache.org Date: Tue, 16 Feb 2016 16:06:49 -0000 Message-Id: <23ab7b3fcae3444f8ff092c4bbbdd6a9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-geode git commit: GEODE-954: display HostnameForClient in the member list view Repository: incubator-geode Updated Branches: refs/heads/develop 00c69b670 -> bef0c1bec GEODE-954: display HostnameForClient in the member list view * retrieve the hostnameforClient and bindAddress attributes from the mbean * add a column in the member list view to display it. If hostnameforclient is empty, use bindAddress * have the tooltip show the entire content of the cell in case the cell is too short * modify the ui tests to reflect the ui change * refactor if/else into switch statement GEODE-913: modifiable Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8fd91dde Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8fd91dde Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8fd91dde Branch: refs/heads/develop Commit: 8fd91dde15b7c4af73776ce8490d1a6cfbcf8f97 Parents: 7c195af Author: Jinmei Liao Authored: Thu Feb 11 14:50:17 2016 -0800 Committer: Jinmei Liao Committed: Tue Feb 16 08:04:57 2016 -0800 ---------------------------------------------------------------------- .../tools/pulse/internal/data/Cluster.java | 38 +- .../pulse/internal/data/JMXDataUpdater.java | 742 ++++++++++--------- .../pulse/internal/data/PulseConstants.java | 7 +- .../internal/service/ClusterMemberService.java | 19 +- .../internal/service/MemberDetailsService.java | 15 +- .../internal/service/MembersListService.java | 13 +- .../webapp/scripts/pulsescript/clusterDetail.js | 70 +- .../tools/pulse/tests/PulseBaseTest.java | 6 +- .../gemfire/tools/pulse/tests/PulseTest.java | 4 +- 9 files changed, 475 insertions(+), 439 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java index a65a07e..732a1b0 100644 --- a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java +++ b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/Cluster.java @@ -20,14 +20,21 @@ package com.vmware.gemfire.tools.pulse.internal.data; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; +import com.vmware.gemfire.tools.pulse.internal.json.JSONArray; +import com.vmware.gemfire.tools.pulse.internal.json.JSONException; +import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; +import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter; +import com.vmware.gemfire.tools.pulse.internal.util.StringUtils; +import org.apache.commons.collections.buffer.CircularFifoBuffer; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.net.ConnectException; import java.net.URL; import java.text.DateFormat; @@ -36,24 +43,17 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; -import java.util.Iterator; import java.util.ResourceBundle; import java.util.Set; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.collections.buffer.CircularFifoBuffer; - -import com.vmware.gemfire.tools.pulse.internal.json.JSONArray; -import com.vmware.gemfire.tools.pulse.internal.json.JSONException; -import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; -import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter; - /** * Class Cluster This class is the Data Model for the data used for the Pulse * Web UI. @@ -235,6 +235,8 @@ public class Cluster extends Thread { private boolean manager; private int totalRegionCount; private String host; + private String hostnameForClients; + private String bindAddress; private long currentHeapSize; private long maxHeapSize; private int avgHeapUsage; @@ -448,6 +450,14 @@ public class Cluster extends Thread { return this.host; } + public String getHostnameForClients() { + if(StringUtils.isNotNullNotEmptyNotWhiteSpace(hostnameForClients)) + return this.hostnameForClients; + else if(StringUtils.isNotNullNotEmptyNotWhiteSpace(bindAddress)) + return this.bindAddress; + return null; + } + public Long getUptime() { return this.uptime; } @@ -524,6 +534,14 @@ public class Cluster extends Thread { this.host = host; } + public void setHostnameForClients(String hostnameForClients) { + this.hostnameForClients = hostnameForClients; + } + + public void setBindAddress(String bindAddress){ + this.bindAddress = bindAddress; + } + public void setUptime(Long uptime) { this.uptime = uptime; } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java index 1cd5fd7..8e4557a 100644 --- a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java +++ b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java @@ -19,25 +19,12 @@ package com.vmware.gemfire.tools.pulse.internal.data; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.management.ManagementFactory; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.ResourceBundle; -import java.util.Set; +import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController; +import com.vmware.gemfire.tools.pulse.internal.data.JmxManagerFinder.JmxManagerInfo; +import com.vmware.gemfire.tools.pulse.internal.json.JSONException; +import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; +import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter; +import com.vmware.gemfire.tools.pulse.internal.util.StringUtils; import javax.management.Attribute; import javax.management.AttributeList; @@ -58,13 +45,25 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.rmi.ssl.SslRMIClientSocketFactory; - -import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController; -import com.vmware.gemfire.tools.pulse.internal.data.JmxManagerFinder.JmxManagerInfo; -import com.vmware.gemfire.tools.pulse.internal.json.JSONException; -import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; -import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter; -import com.vmware.gemfire.tools.pulse.internal.util.StringUtils; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.management.ManagementFactory; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.ResourceBundle; +import java.util.Set; /** * Class JMXDataUpdater Class used for creating JMX connection and getting all @@ -499,12 +498,14 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { Set memberMBeans = this.mbs.queryNames( this.MBEAN_OBJECT_NAME_MEMBER, null); for (ObjectName memMBean : memberMBeans) { - // member regions - if (memMBean.getKeyProperty(PulseConstants.MBEAN_KEY_PROPERTY_SERVICE) != null) { - if (memMBean - .getKeyProperty(PulseConstants.MBEAN_KEY_PROPERTY_SERVICE) - .equals(PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_REGION)) { - + String service = memMBean.getKeyProperty(PulseConstants.MBEAN_KEY_PROPERTY_SERVICE); + if(service==null){ + // Cluster Member + updateClusterMember(memMBean); + } + else { + switch (service) { + case PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_REGION: if (PulseConstants.PRODUCT_NAME_SQLFIRE .equalsIgnoreCase(PulseController.getPulseProductSupport())) { // For SQLfire @@ -522,31 +523,23 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { // For Gemfire updateMemberRegion(memMBean); } - - } else if (memMBean.getKeyProperty( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE).equals( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_CACHESERVER)) { + break; + case PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_CACHESERVER: updateMemberClient(memMBean); - } - // Gateway Receiver Attributes - else if (memMBean.getKeyProperty( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE).equals( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_GATEWAYRECEIVER)) { + break; + case PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_GATEWAYRECEIVER: updateGatewayReceiver(memMBean); - } else if (memMBean.getKeyProperty( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE).equals( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_GATEWAYSENDER)) { - updateGatewaySender(memMBean); - } else if(memMBean.getKeyProperty( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE).equals( - PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_ASYNCEVENTQUEUE)){ - - // AsyncEventQueue - updateAsyncEventQueue(memMBean); + break; + case PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_GATEWAYSENDER: + updateGatewaySender(memMBean); + break; + case PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_ASYNCEVENTQUEUE: + updateAsyncEventQueue(memMBean); + break; + case PulseConstants.MBEAN_KEY_PROPERTY_SERVICE_VALUE_LOCATOR: + updateClusterMember(memMBean); + break; } - } else { - // Cluster Member - updateClusterMember(memMBean); } } @@ -650,25 +643,25 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_MEMBERCOUNT)) { + String name = attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_MEMBERCOUNT: cluster.setMemberCount(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMCLIENTS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMCLIENTS: cluster.setClientConnectionCount(getIntegerAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISTRIBUTEDSYSTEMID)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISTRIBUTEDSYSTEMID: cluster.setClusterId(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LOCATORCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_LOCATORCOUNT: cluster.setLocatorCount(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMRUNNIGFUNCTION)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMRUNNIGFUNCTION: try { cluster.setRunningFunctionCount(getIntegerAttribute( attribute.getValue(), attribute.getName())); @@ -676,28 +669,28 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { cluster.setRunningFunctionCount(0); continue; } - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_REGISTEREDCQCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_REGISTEREDCQCOUNT: cluster.setRegisteredCQCount(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMSUBSCRIPTIONS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMSUBSCRIPTIONS: cluster.setSubscriptionCount(getIntegerAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMTXNCOMMITTED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMTXNCOMMITTED: cluster.setTxnCommittedCount(getIntegerAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMTXNROLLBACK)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMTXNROLLBACK: cluster.setTxnRollbackCount(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALHEAPSIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALHEAPSIZE: cluster.setTotalHeapSize(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_USEDHEAPSIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_USEDHEAPSIZE: try { cluster.setUsedHeapSize(getLongAttribute(attribute.getValue(), attribute.getName())); @@ -706,16 +699,16 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { continue; } cluster.getMemoryUsageTrend().add(cluster.getUsedHeapSize()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALREGIONENTRYCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALREGIONENTRYCOUNT: cluster.setTotalRegionEntryCount(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_CURRENTENTRYCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_CURRENTENTRYCOUNT: cluster.setCurrentQueryCount(getIntegerAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALDISKUSAGE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALDISKUSAGE: try { cluster.setTotalBytesOnDisk(getLongAttribute(attribute.getValue(), attribute.getName())); @@ -724,13 +717,13 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { continue; } cluster.getTotalBytesOnDiskTrend().add(cluster.getTotalBytesOnDisk()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE: cluster.setDiskWritesRate(getFloatAttribute(attribute.getValue(), attribute.getName())); cluster.getThroughoutWritesTrend().add(cluster.getDiskWritesRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AVERAGEWRITES)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AVERAGEWRITES: try { cluster.setWritePerSec(getFloatAttribute(attribute.getValue(), attribute.getName())); @@ -739,8 +732,8 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { continue; } cluster.getWritePerSecTrend().add(cluster.getWritePerSec()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AVERAGEREADS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AVERAGEREADS: try { cluster.setReadPerSec(getFloatAttribute(attribute.getValue(), attribute.getName())); @@ -749,43 +742,34 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { continue; } cluster.getReadPerSecTrend().add(cluster.getReadPerSec()); - - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_QUERYREQUESTRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_QUERYREQUESTRATE: cluster.setQueriesPerSec(getFloatAttribute(attribute.getValue(), attribute.getName())); cluster.getQueriesPerSecTrend().add(cluster.getQueriesPerSec()); - - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE: cluster.setDiskReadsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); cluster.getThroughoutReadsTrend().add(cluster.getDiskReadsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_JVMPAUSES)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_JVMPAUSES: long trendVal = determineCurrentJVMPauses( PulseConstants.JVM_PAUSES_TYPE_CLUSTER, "", getLongAttribute(attribute.getValue(), attribute.getName())); cluster.setGarbageCollectionCount(trendVal); cluster.getGarbageCollectionTrend().add( cluster.getGarbageCollectionCount()); - - } - - // For SQLfire or Gemfire - if (PulseConstants.PRODUCT_NAME_SQLFIRE - .equalsIgnoreCase(PulseController.getPulseProductSupport())) { - // For SQLfire - // Do nothing - } else { - // For Gemfire - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALREGIONCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALREGIONCOUNT: + if (!PulseConstants.PRODUCT_NAME_SQLFIRE + .equalsIgnoreCase(PulseController.getPulseProductSupport())){ + // for Gemfire cluster.setTotalRegionCount(getIntegerAttribute( attribute.getValue(), attribute.getName())); } + break; } - } // SQLFIRE attributes @@ -923,46 +907,48 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_EVENTRECEIVEDDATE)) { + String name = attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_EVENTRECEIVEDDATE: gatewaySender.setLinkThroughput(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_BATCHSIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_BATCHSIZE: gatewaySender.setBatchSize(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_SENDERID)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_SENDERID: gatewaySender.setId(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_EVENTQUEUESIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_EVENTQUEUESIZE: gatewaySender.setQueueSize(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_RUNNING)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_RUNNING: gatewaySender.setStatus(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PRIMARY)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PRIMARY: gatewaySender.setPrimary(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PERSISTENCEENABLED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PERSISTENCEENABLED: gatewaySender.setPersistenceEnabled(getBooleanAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PARALLEL)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PARALLEL: gatewaySender.setSenderType(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_REMOTE_DS_ID)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_REMOTE_DS_ID: gatewaySender.setRemoteDSId(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_EVENTS_EXCEEDING_ALERT_THRESHOLD)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_EVENTS_EXCEEDING_ALERT_THRESHOLD: gatewaySender.setEventsExceedingAlertThreshold(getIntegerAttribute(attribute.getValue(), attribute.getName())); + break; } } return gatewaySender; @@ -1039,38 +1025,40 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_ASYNCEVENTID)) { + String name = attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_ASYNCEVENTID: asyncEventQueue.setId(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_ASYNC_EVENT_LISTENER)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_ASYNC_EVENT_LISTENER: asyncEventQueue.setAsyncEventListener(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_BATCH_CONFLATION_ENABLED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_BATCH_CONFLATION_ENABLED: asyncEventQueue.setBatchConflationEnabled(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_BATCH_TIME_INTERVAL)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_BATCH_TIME_INTERVAL: asyncEventQueue.setBatchTimeInterval(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_BATCH_SIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_BATCH_SIZE: asyncEventQueue.setBatchSize(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_EVENT_QUEUE_SIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_EVENT_QUEUE_SIZE: asyncEventQueue.setEventQueueSize(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_PARALLEL)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_PARALLEL: asyncEventQueue.setParallel(getBooleanAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AEQ_PRIMARY)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AEQ_PRIMARY: asyncEventQueue.setPrimary(getBooleanAttribute(attribute.getValue(), attribute.getName())); + break; } } return asyncEventQueue; @@ -1177,6 +1165,10 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { + this.mbs.getAttribute(mbeanName, PulseConstants.MBEAN_ATTRIBUTE_PORT)); + this.mbs.getAttribute(mbeanName, PulseConstants.MBEAN_ATTRIBUTE_HOSTNAMEFORCLIENTS_ALT); + existingMember.setHostnameForClients((String)this.mbs.getAttribute(mbeanName, PulseConstants.MBEAN_ATTRIBUTE_HOSTNAMEFORCLIENTS_ALT)); + existingMember.setBindAddress((String)this.mbs.getAttribute(mbeanName, PulseConstants.MBEAN_ATTRIBUTE_BINDADDRESS)); + CompositeData[] compositeData = (CompositeData[]) (this.mbs.invoke( mbeanName, PulseConstants.MBEAN_OPERATION_SHOWALLCLIENTS, null, null)); @@ -1285,42 +1277,44 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { AttributeList attributeList = this.mbs.getAttributes(regionOnMemberMBean, PulseConstants.REGION_ON_MEMBER_MBEAN_ATTRIBUTES); for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE)) { - anRom.setEntrySize(getLongAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getEntrySize() = " + anRom.getEntrySize()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYCOUNT)) { - anRom.setEntryCount(getLongAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getEntryCount() = " + anRom.getEntryCount()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE)) { - anRom.setPutsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getPutsRate() = " + anRom.getPutsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GETSRATE)) { - anRom.setGetsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getGetsRate() = " + anRom.getGetsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE)) { - anRom.setDiskGetsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getDiskGetsRate() = " + anRom.getDiskGetsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE)) { - anRom.setDiskPutsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getDiskPutsRate() = " + anRom.getDiskPutsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LOCALMAXMEMORY)) { - anRom.setLocalMaxMemory(getIntegerAttribute(attribute.getValue(), - attribute.getName())); - LOGGER.fine("updateRegionOnMembers : anRom.getLocalMaxMemory() = " + anRom.getLocalMaxMemory()); - } + String name = attribute.getName(); + switch(name){ + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE: + anRom.setEntrySize(getLongAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getEntrySize() = " + anRom.getEntrySize()); + break; + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYCOUNT: + anRom.setEntryCount(getLongAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getEntryCount() = " + anRom.getEntryCount()); + break; + case PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE: + anRom.setPutsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getPutsRate() = " + anRom.getPutsRate()); + break; + case PulseConstants.MBEAN_ATTRIBUTE_GETSRATE: + anRom.setGetsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getGetsRate() = " + anRom.getGetsRate()); + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE: + anRom.setDiskGetsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getDiskGetsRate() = " + anRom.getDiskGetsRate()); + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE: + anRom.setDiskPutsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getDiskPutsRate() = " + anRom.getDiskPutsRate()); + break; + case PulseConstants.MBEAN_ATTRIBUTE_LOCALMAXMEMORY: + anRom.setLocalMaxMemory(getIntegerAttribute(attribute.getValue(), + attribute.getName())); + LOGGER.fine("updateRegionOnMembers : anRom.getLocalMaxMemory() = " + anRom.getLocalMaxMemory()); + break; + } } anRom.getGetsPerSecTrend().add(anRom.getGetsRate()); @@ -1351,35 +1345,37 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { AttributeList attributeList = this.mbs.getAttributes(regionOnMemberMBean, PulseConstants.REGION_ON_MEMBER_MBEAN_ATTRIBUTES); for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE)) { - regionOnMember.setEntrySize(getLongAttribute(attribute.getValue(), - attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYCOUNT)) { - regionOnMember.setEntryCount(getLongAttribute(attribute.getValue(), - attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE)) { - regionOnMember.setPutsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GETSRATE)) { - regionOnMember.setGetsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE)) { - regionOnMember.setDiskGetsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE)) { - regionOnMember.setDiskPutsRate(getFloatAttribute(attribute.getValue(), - attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LOCALMAXMEMORY)) { - regionOnMember.setLocalMaxMemory(getIntegerAttribute(attribute.getValue(), - attribute.getName())); - } + String name=attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE: + regionOnMember.setEntrySize(getLongAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYCOUNT: + regionOnMember.setEntryCount(getLongAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE: + regionOnMember.setPutsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_GETSRATE: + regionOnMember.setGetsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE: + regionOnMember.setDiskGetsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE: + regionOnMember.setDiskPutsRate(getFloatAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_LOCALMAXMEMORY: + regionOnMember.setLocalMaxMemory(getIntegerAttribute(attribute.getValue(), + attribute.getName())); + break; + } } regionOnMember.getGetsPerSecTrend().add(regionOnMember.getGetsRate()); @@ -1442,72 +1438,75 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { Attribute attribute = (Attribute) attributeList.get(i); - if (attribute.getName().equals(PulseConstants.MBEAN_ATTRIBUTE_MEMBERS)) { + String name = attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_MEMBERS: String memName[] = (String[]) attribute.getValue(); region.getMemberName().clear(); for (int k = 0; k < memName.length; k++) { region.getMemberName().add(memName[k]); } - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_FULLPATH)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_FULLPATH: region.setFullPath(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE: region.setDiskReadsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE: region.setDiskWritesRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_EMPTYNODES)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_EMPTYNODES: region.setEmptyNode(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GETSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_GETSRATE: region.setGetsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LRUEVICTIONRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_LRUEVICTIONRATE: region.setLruEvictionRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE: region.setPutsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_REGIONTYPE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_REGIONTYPE: region.setRegionType(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE: region.setEntrySize(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_SYSTEMREGIONENTRYCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_SYSTEMREGIONENTRYCOUNT: region.setSystemRegionEntryCount(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_MEMBERCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_MEMBERCOUNT: region.setMemberCount(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PERSISTENTENABLED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PERSISTENTENABLED: region.setPersistentEnabled(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NAME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NAME: region.setName(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GATEWAYENABLED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_GATEWAYENABLED: region.setWanEnabled(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKUSAGE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKUSAGE: region.setDiskUsage(getLongAttribute(attribute.getValue(), attribute.getName())); + break; } } @@ -1635,86 +1634,85 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { } for (int i = 0; i < attributeList.size(); i++) { - Attribute attribute = (Attribute) attributeList.get(i); - - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESCOMPILED)) { + String name = attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESCOMPILED: statement.setNumTimesCompiled(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTION)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTION: statement.setNumExecution(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTIONSINPROGRESS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMEXECUTIONSINPROGRESS: statement.setNumExecutionsInProgress(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESGLOBALINDEXLOOKUP)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMTIMESGLOBALINDEXLOOKUP: statement.setNumTimesGlobalIndexLookup(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMROWSMODIFIED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMROWSMODIFIED: statement.setNumRowsModified(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PARSETIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PARSETIME: statement.setParseTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_BINDTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_BINDTIME: statement.setBindTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_OPTIMIZETIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_OPTIMIZETIME: statement.setOptimizeTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ROUTINGINFOTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_ROUTINGINFOTIME: statement.setRoutingInfoTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GENERATETIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_GENERATETIME: statement.setGenerateTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALCOMPILATIONTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALCOMPILATIONTIME: statement.setTotalCompilationTime(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_EXECUTIONTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_EXECUTIONTIME: statement.setExecutionTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PROJECTIONTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PROJECTIONTIME: statement.setProjectionTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALEXECUTIONTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALEXECUTIONTIME: statement.setTotalExecutionTime(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ROWSMODIFICATIONTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_ROWSMODIFICATIONTIME: statement.setRowsModificationTime(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_QNNUMROWSSEEN)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_QNNUMROWSSEEN: statement.setqNNumRowsSeen(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_QNMSGSENDTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_QNMSGSENDTIME: statement.setqNMsgSendTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_QNMSGSERTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_QNMSGSERTIME: statement.setqNMsgSerTime(getLongAttribute(attribute.getValue(), attribute.getName())); - } - if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_QNRESPDESERTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_QNRESPDESERTIME: statement.setqNRespDeSerTime(getLongAttribute(attribute.getValue(), attribute.getName())); + break; } } @@ -1737,7 +1735,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { */ private Cluster.Member initializeMember(ObjectName mbeanName, Cluster.Member member) throws InstanceNotFoundException, - ReflectionException, IOException { + ReflectionException, IOException { AttributeList attributeList = this.mbs.getAttributes(mbeanName, PulseConstants.MEMBER_MBEAN_ATTRIBUTES); @@ -1745,53 +1743,55 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - - if (attribute.getName().equals(PulseConstants.MBEAN_ATTRIBUTE_GEMFIREVERSION)) { + String name = attribute.getName(); + switch (name) { + case PulseConstants.MBEAN_ATTRIBUTE_GEMFIREVERSION: if (member.getGemfireVersion() == null) { // Set Member's GemFire Version if not set already String gemfireVersion = obtainGemfireVersion(getStringAttribute( attribute.getValue(), attribute.getName())); member.setGemfireVersion(gemfireVersion); } - } else if (attribute.getName().equals(PulseConstants.MBEAN_ATTRIBUTE_MANAGER)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_MANAGER: member.setManager(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALREGIONCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALREGIONCOUNT: member.setTotalRegionCount(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LOCATOR)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_LOCATOR: member.setLocator(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALDISKUSAGE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALDISKUSAGE: member.setTotalDiskUsage(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_SERVER)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_SERVER: member.setServer(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALFILEDESCRIPTOROPEN)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALFILEDESCRIPTOROPEN: member.setTotalFileDescriptorOpen(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LOADAVERAGE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_LOADAVERAGE: member.setLoadAverage(getDoubleAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE: member.setThroughputWrites(getFloatAttribute(attribute.getValue(), attribute.getName())); member.getThroughputWritesTrend().add(member.getThroughputWrites()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE: member.setThroughputReads(getFloatAttribute(attribute.getValue(), attribute.getName())); member.getThroughputReadsTrend().add(member.getThroughputReads()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_JVMPAUSES)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_JVMPAUSES: long trendVal = determineCurrentJVMPauses( PulseConstants.JVM_PAUSES_TYPE_MEMBER, member.getName(), getLongAttribute(attribute.getValue(), @@ -1799,83 +1799,86 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { member.setGarbageCollectionCount(trendVal); member.getGarbageCollectionSamples().add( member.getGarbageCollectionCount()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_USEDMEMORY)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_USEDMEMORY: member.setCurrentHeapSize(getLongAttribute(attribute.getValue(), attribute.getName())); member.getHeapUsageSamples().add(member.getCurrentHeapSize()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_MAXMEMORY)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_MAXMEMORY: member.setMaxHeapSize(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NUMTHREADS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NUMTHREADS: member.setNumThreads(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_MEMBERUPTIME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_MEMBERUPTIME: member.setUptime(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName() - .equals(PulseConstants.MBEAN_ATTRIBUTE_HOST)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_HOST: member.setHost(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_TOTALBYTESONDISK)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_HOSTNAMEFORCLIENTS: + member.setHostnameForClients(getStringAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_BINDADDRESS: + member.setBindAddress(getStringAttribute(attribute.getValue(), + attribute.getName())); + break; + case PulseConstants.MBEAN_ATTRIBUTE_TOTALBYTESONDISK: member.setTotalBytesOnDisk(getLongAttribute(attribute.getValue(), attribute.getName())); member.getTotalBytesOnDiskSamples().add(member.getTotalBytesOnDisk()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_CPUUSAGE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_CPUUSAGE: member.setCpuUsage(getFloatAttribute(attribute.getValue(), attribute.getName())); member.getCpuUsageSamples().add(member.getCpuUsage()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_HOSTCPUUSAGE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_HOSTCPUUSAGE: // Float value is expected for host cpu usage. // TODO Remove Float.valueOf() when float value is provided in mbean member.setHostCpuUsage(Float.valueOf(getIntegerAttribute( attribute.getValue(), attribute.getName()))); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_MEMBER)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_MEMBER: member.setName(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals(PulseConstants.MBEAN_ATTRIBUTE_ID)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_ID: member.setId(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AVERAGEREADS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AVERAGEREADS: member.setGetsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); member.getGetsPerSecond().add(member.getGetsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_AVERAGEWRITES)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_AVERAGEWRITES: member.setPutsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); member.getPutsPerSecond().add(member.getPutsRate()); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_OFFHEAPFREESIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_OFFHEAPFREESIZE: member.setOffHeapFreeSize(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_OFFHEAPUSEDSIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_OFFHEAPUSEDSIZE: member.setOffHeapUsedSize(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_SERVERGROUPS)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_SERVERGROUPS: String sgValues[] = (String[]) attribute.getValue(); member.getServerGroups().clear(); for (int k = 0; k < sgValues.length; k++) { member.getServerGroups().add(sgValues[k]); } - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_REDUNDANCYZONES)) { - /*String rzValues[] = (String[]) attribute.getValue(); - member.getRedundancyZones().clear(); - for (int k = 0; k < rzValues.length; k++) { - member.getRedundancyZones().add(rzValues[k]); - }*/ - + break; + case PulseConstants.MBEAN_ATTRIBUTE_REDUNDANCYZONES: String rzValue = ""; if(null != attribute.getValue()){ rzValue = getStringAttribute(attribute.getValue(), @@ -1885,6 +1888,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { if(!rzValue.isEmpty()){ member.getRedundancyZones().add(rzValue); } + break; } } @@ -2212,58 +2216,60 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener { // update the existing or new region for (int i = 0; i < attributeList.size(); i++) { Attribute attribute = (Attribute) attributeList.get(i); - - if (attribute.getName().equals(PulseConstants.MBEAN_ATTRIBUTE_FULLPATH)) { + String name = attribute.getName(); + switch (name){ + case PulseConstants.MBEAN_ATTRIBUTE_FULLPATH: region.setFullPath(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKREADSRATE: region.setDiskReadsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_DISKWRITESRATE: region.setDiskWritesRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GETSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_GETSRATE: region.setGetsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_LRUEVICTIONRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_LRUEVICTIONRATE: region.setLruEvictionRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PUTSRATE: region.setPutsRate(getFloatAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_REGIONTYPE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_REGIONTYPE: region.setRegionType(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_MEMBERCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_MEMBERCOUNT: region.setMemberCount(getIntegerAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE: region.setEntrySize(getLongAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_ENTRYCOUNT)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_ENTRYCOUNT: region.setSystemRegionEntryCount(getLongAttribute( attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_NAME)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_NAME: region.setName(getStringAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_PERSISTENTENABLED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_PERSISTENTENABLED: region.setPersistentEnabled(getBooleanAttribute(attribute.getValue(), attribute.getName())); - } else if (attribute.getName().equals( - PulseConstants.MBEAN_ATTRIBUTE_GATEWAYENABLED)) { + break; + case PulseConstants.MBEAN_ATTRIBUTE_GATEWAYENABLED: region.setWanEnabled(getBooleanAttribute(attribute.getValue(), attribute.getName())); + break; } } /* GemfireXD related code http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/PulseConstants.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/PulseConstants.java b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/PulseConstants.java index 9c5732e..c2999f8 100644 --- a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/PulseConstants.java +++ b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/PulseConstants.java @@ -131,6 +131,7 @@ public class PulseConstants { public static final String MBEAN_KEY_PROPERTY_SERVICE_VALUE_GATEWAYRECEIVER = "GatewayReceiver"; public static final String MBEAN_KEY_PROPERTY_SERVICE_VALUE_GATEWAYSENDER = "GatewaySender"; public static final String MBEAN_KEY_PROPERTY_SERVICE_VALUE_ASYNCEVENTQUEUE = "AsyncEventQueue"; + public static final String MBEAN_KEY_PROPERTY_SERVICE_VALUE_LOCATOR = "Locator"; public static final String MBEAN_KEY_PROPERTY_REGION_NAME = "name"; public static final String MBEAN_KEY_PROPERTY_MEMBER = "member"; @@ -173,6 +174,9 @@ public class PulseConstants { public static final String MBEAN_ATTRIBUTE_QUERYREQUESTRATE = "QueryRequestRate"; public static final String MBEAN_ATTRIBUTE_JVMPAUSES = "JVMPauses"; public static final String MBEAN_ATTRIBUTE_HOST = "Host"; + public static final String MBEAN_ATTRIBUTE_HOSTNAMEFORCLIENTS = "HostnameForClients"; + public static final String MBEAN_ATTRIBUTE_HOSTNAMEFORCLIENTS_ALT = "HostNameForClients"; + public static final String MBEAN_ATTRIBUTE_BINDADDRESS = "BindAddress"; public static final String MBEAN_ATTRIBUTE_PORT = "Port"; public static final String MBEAN_ATTRIBUTE_EVENTRECEIVEDDATE = "EventsReceivedRate"; public static final String MBEAN_ATTRIBUTE_AVEARGEBATCHPROCESSINGTIME = "AverageBatchProcessingTime"; @@ -359,7 +363,8 @@ public class PulseConstants { MBEAN_ATTRIBUTE_DISKREADSRATE, MBEAN_ATTRIBUTE_JVMPAUSES, MBEAN_ATTRIBUTE_USEDMEMORY, MBEAN_ATTRIBUTE_MAXMEMORY, MBEAN_ATTRIBUTE_NUMTHREADS, MBEAN_ATTRIBUTE_MEMBERUPTIME, - MBEAN_ATTRIBUTE_HOST, MBEAN_ATTRIBUTE_TOTALBYTESONDISK, + MBEAN_ATTRIBUTE_HOST, MBEAN_ATTRIBUTE_HOSTNAMEFORCLIENTS, + MBEAN_ATTRIBUTE_BINDADDRESS, MBEAN_ATTRIBUTE_TOTALBYTESONDISK, MBEAN_ATTRIBUTE_CPUUSAGE, MBEAN_ATTRIBUTE_HOSTCPUUSAGE, MBEAN_ATTRIBUTE_MEMBER, MBEAN_ATTRIBUTE_ID, MBEAN_ATTRIBUTE_AVERAGEREADS, MBEAN_ATTRIBUTE_AVERAGEWRITES, MBEAN_ATTRIBUTE_OFFHEAPFREESIZE, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java index a3550b5..80e0b2e 100644 --- a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java +++ b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterMemberService.java @@ -19,16 +19,6 @@ package com.vmware.gemfire.tools.pulse.internal.service; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController; import com.vmware.gemfire.tools.pulse.internal.data.Cluster; import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants; @@ -36,6 +26,14 @@ import com.vmware.gemfire.tools.pulse.internal.data.Repository; import com.vmware.gemfire.tools.pulse.internal.json.JSONException; import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; import com.vmware.gemfire.tools.pulse.internal.util.TimeUtils; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; /** * Class ClusterMemberService @@ -73,6 +71,7 @@ public class ClusterMemberService implements PulseService { memberJSON.put("memberId", clusterMember.getId()); memberJSON.put("name", clusterMember.getName()); memberJSON.put("host", clusterMember.getHost()); + memberJSON.put("hostnameForClients", clusterMember.getHostnameForClients()); List serverGroups = clusterMember.getServerGroups(); if(serverGroups.size() == 0){ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java index 273ebec..7e55712 100644 --- a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java +++ b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MemberDetailsService.java @@ -19,14 +19,6 @@ package com.vmware.gemfire.tools.pulse.internal.service; -import java.text.DecimalFormat; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - import com.vmware.gemfire.tools.pulse.internal.controllers.PulseController; import com.vmware.gemfire.tools.pulse.internal.data.Cluster; import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants; @@ -34,6 +26,12 @@ import com.vmware.gemfire.tools.pulse.internal.data.Repository; import com.vmware.gemfire.tools.pulse.internal.json.JSONException; import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; import com.vmware.gemfire.tools.pulse.internal.util.StringUtils; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.text.DecimalFormat; /** * Class MemberDetailsService @@ -70,6 +68,7 @@ public class MemberDetailsService implements PulseService { responseJSON.put("memberId", clusterMember.getId()); responseJSON.put("name", clusterMember.getName()); responseJSON.put("host", clusterMember.getHost()); + responseJSON.put("hostnameForClients", clusterMember.getHostnameForClients()); responseJSON.put("clusterId", cluster.getId()); responseJSON.put("clusterName", cluster.getServerName()); responseJSON.put("userName", userName); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java index f51de16..3a730c5 100644 --- a/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java +++ b/gemfire-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/MembersListService.java @@ -19,17 +19,16 @@ package com.vmware.gemfire.tools.pulse.internal.service; -import javax.servlet.http.HttpServletRequest; - -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; - import com.vmware.gemfire.tools.pulse.internal.data.Cluster; import com.vmware.gemfire.tools.pulse.internal.data.Repository; import com.vmware.gemfire.tools.pulse.internal.json.JSONArray; import com.vmware.gemfire.tools.pulse.internal.json.JSONException; import com.vmware.gemfire.tools.pulse.internal.json.JSONObject; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; /** * Class MembersListService @@ -62,7 +61,7 @@ public class MembersListService implements PulseService { memberJSON.put("memberId", member.getId()); memberJSON.put("name", member.getName()); memberJSON.put("host", member.getHost()); - + memberJSON.put("hostnameForClients", member.getHostnameForClients()); memberListJson.put(memberJSON); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/main/webapp/scripts/pulsescript/clusterDetail.js ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/main/webapp/scripts/pulsescript/clusterDetail.js b/gemfire-pulse/src/main/webapp/scripts/pulsescript/clusterDetail.js index 8a6c08a..a9f1486 100644 --- a/gemfire-pulse/src/main/webapp/scripts/pulsescript/clusterDetail.js +++ b/gemfire-pulse/src/main/webapp/scripts/pulsescript/clusterDetail.js @@ -764,26 +764,26 @@ function createMemberGridDefault() { width : 740, rowNum : 200, shrinkToFit : false, - colNames : [ 'ID', 'Name', 'Host', 'Heap Usage (MB)', 'CPU Usage (%)', + colNames : [ 'ID', 'Name', 'Host', 'Hostname For Clients', 'Heap Usage (MB)', 'CPU Usage (%)', 'Uptime', 'Clients', 'CurrentHeapSize', 'Load Avg', 'Threads', 'Sockets'], colModel : [ { name : 'memberId', index : 'memberId', - width : 170, + width : 150, sorttype : "string", cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject) ; }, sortable : true }, { name : 'name', index : 'name', - width : 150, + width : 120, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "string" @@ -791,9 +791,19 @@ function createMemberGridDefault() { { name : 'host', index : 'host', - width : 100, + width : 80, + cellattr : function(rowId, val, rawObject, cm, rdata) { + return formMemberGridToolTip(val, rawObject); + }, + sortable : true, + sorttype : "string" + }, + { + name : 'hostnameForClients', + index : 'hostnameForClients', + width : 90, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "string" @@ -801,10 +811,10 @@ function createMemberGridDefault() { { name : 'currentHeapUsage', index : 'currentHeapUsage', - width : 110, + width : 100, align : 'right', cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "float" @@ -815,7 +825,7 @@ function createMemberGridDefault() { align : 'right', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "float" @@ -825,7 +835,7 @@ function createMemberGridDefault() { index : 'uptime', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "int" @@ -836,7 +846,7 @@ function createMemberGridDefault() { width : 100, align : 'right', cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "int" @@ -948,7 +958,7 @@ function createMemberGridSG() { width : 170, sorttype : "string", cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true }, @@ -958,7 +968,7 @@ function createMemberGridSG() { width : 170, sorttype : "string", cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true }, @@ -967,7 +977,7 @@ function createMemberGridSG() { index : 'name', width : 150, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "string" @@ -977,7 +987,7 @@ function createMemberGridSG() { index : 'host', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "string" @@ -988,7 +998,7 @@ function createMemberGridSG() { width : 110, align : 'right', cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "float" @@ -999,7 +1009,7 @@ function createMemberGridSG() { align : 'right', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "float" @@ -1009,7 +1019,7 @@ function createMemberGridSG() { index : 'uptime', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "int" @@ -1020,7 +1030,7 @@ function createMemberGridSG() { width : 100, align : 'right', cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "int" @@ -1132,7 +1142,7 @@ function createMemberGridRZ() { width : 170, sorttype : "string", cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true }, @@ -1142,7 +1152,7 @@ function createMemberGridRZ() { width : 170, sorttype : "string", cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true }, @@ -1151,7 +1161,7 @@ function createMemberGridRZ() { index : 'name', width : 150, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "string" @@ -1161,7 +1171,7 @@ function createMemberGridRZ() { index : 'host', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "string" @@ -1172,7 +1182,7 @@ function createMemberGridRZ() { width : 110, align : 'right', cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "float" @@ -1183,7 +1193,7 @@ function createMemberGridRZ() { align : 'right', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "float" @@ -1193,7 +1203,7 @@ function createMemberGridRZ() { index : 'uptime', width : 100, cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "int" @@ -1204,7 +1214,7 @@ function createMemberGridRZ() { width : 100, align : 'right', cellattr : function(rowId, val, rawObject, cm, rdata) { - return formMemberGridToolTip(rawObject); + return formMemberGridToolTip(val, rawObject); }, sortable : true, sorttype : "int" @@ -1943,8 +1953,8 @@ function buildRZMembersGridData(members) { } // Tool tip for members in grid -function formMemberGridToolTip(rawObject) { - return 'title="Name: ' + rawObject.name + ' , CPU Usage: ' +function formMemberGridToolTip(detail, rawObject) { + return 'title="'+detail+ ', CPU Usage: ' + rawObject.cpuUsage + '% , Heap Usage: ' + rawObject.currentHeapUsage + 'MB , Load Avg.: ' + rawObject.loadAvg + ' , Threads: ' + rawObject.threads http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseBaseTest.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseBaseTest.java b/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseBaseTest.java index 74cfa8d..f239bb6 100644 --- a/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseBaseTest.java +++ b/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseBaseTest.java @@ -221,10 +221,10 @@ public class PulseBaseTest extends PulseTest { public void validateTopologyGridData() { List rzGridRows = driver.findElements(By.xpath("//table[@id='memberList']/tbody/tr")); int rowsCount = rzGridRows.size(); - String[][] gridDataFromUI = new String[rowsCount][7]; + String[][] gridDataFromUI = new String[rowsCount][8]; for (int j = 2, x = 0; j <= rzGridRows.size(); j++, x++) { - for (int i = 0; i <= 6; i++) { + for (int i = 0; i <= 7; i++) { gridDataFromUI[x][i] = driver.findElement( By.xpath("//table[@id='memberList']/tbody/tr[" + j + "]/td[" + (i + 1) + "]")).getText(); } @@ -248,7 +248,7 @@ public class PulseBaseTest extends PulseTest { Assert.assertEquals(m.getMember(), gridDataFromUI[i][1]); Assert.assertEquals(m.getHost(), gridDataFromUI[i][2]); String cupUsage = String.valueOf(m.getCpuUsage()); - Assert.assertEquals(cupUsage, gridDataFromUI[i][4]); + Assert.assertEquals(cupUsage, gridDataFromUI[i][5]); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8fd91dde/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java ---------------------------------------------------------------------- diff --git a/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java b/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java index ec06085..b7e5f1f 100644 --- a/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java +++ b/gemfire-pulse/src/test/java/com/vmware/gemfire/tools/pulse/tests/PulseTest.java @@ -407,7 +407,7 @@ public class PulseTest { for (int i = 1; i <= 3; i++) { Float HeapUsage = Float.parseFloat(driver .findElement( - By.xpath("//table[@id='memberList']/tbody/tr[" + (i + 1) + "]/td[4]")).getText()); + By.xpath("//table[@id='memberList']/tbody/tr[" + (i + 1) + "]/td[5]")).getText()); Float gridHeapUsagestring = Float.parseFloat(JMXProperties.getInstance() .getProperty("member.M" + i + ".UsedMemory")); Assert.assertEquals(gridHeapUsagestring, HeapUsage); @@ -418,7 +418,7 @@ public class PulseTest { public void testClusterGridViewCPUUsage() { searchByIdAndClick("default_grid_button"); for (int i = 1; i <= 3; i++) { - String CPUUsage = driver.findElement(By.xpath("//table[@id='memberList']/tbody/tr[" + (i + 1) + "]/td[5]")).getText(); + String CPUUsage = driver.findElement(By.xpath("//table[@id='memberList']/tbody/tr[" + (i + 1) + "]/td[6]")).getText(); String gridCPUUsage = JMXProperties.getInstance().getProperty("member.M" + i + ".cpuUsage"); gridCPUUsage = gridCPUUsage.trim(); Assert.assertEquals(gridCPUUsage, CPUUsage);