[infinispan-commits] Infinispan SVN: r1205 - in trunk: core/src/main/java/org/infinispan/remoting/transport and 2 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Nov 23 09:15:51 EST 2009


Author: galder.zamarreno at jboss.com
Date: 2009-11-23 09:15:50 -0500 (Mon, 23 Nov 2009)
New Revision: 1205

Modified:
   trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java
   trunk/core/src/main/java/org/infinispan/remoting/transport/Transport.java
   trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java
   trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml
Log:
[ISPN-270] (Expose physical address for management purpouses) Done.

Modified: trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java	2009-11-18 15:48:58 UTC (rev 1204)
+++ trunk/core/src/main/java/org/infinispan/remoting/rpc/RpcManagerImpl.java	2009-11-23 14:15:50 UTC (rev 1205)
@@ -43,6 +43,7 @@
  * implementations.
  *
  * @author Manik Surtani
+ * @author Galder Zamarreño
  * @since 4.0
  */
 @MBean(objectName = "RpcManager", description = "Manages all remote calls to remote cache instances in the cluster.")
@@ -332,6 +333,14 @@
       return address == null ? "N/A" : address.toString();
    }
 
+   @ManagedAttribute(description = "The physical network address associated with this instance")
+   @Metric(displayName = "Physical network address", dataType = DataType.TRAIT, displayType = DisplayType.SUMMARY)
+   public String getPhysicalAddress() {
+      if (t == null || !isStatisticsEnabled()) return "N/A";
+      Address address = t.getPhysicalAddress();
+      return address == null ? "N/A" : address.toString();
+   }
+
    @ManagedAttribute(description = "List of members in the cluster")
    @Metric(displayName = "Cluster members", dataType = DataType.TRAIT, displayType = DisplayType.SUMMARY)
    public String getMembers() {

Modified: trunk/core/src/main/java/org/infinispan/remoting/transport/Transport.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/transport/Transport.java	2009-11-18 15:48:58 UTC (rev 1204)
+++ trunk/core/src/main/java/org/infinispan/remoting/transport/Transport.java	2009-11-23 14:15:50 UTC (rev 1205)
@@ -27,6 +27,7 @@
  * this cache instance.
  *
  * @author Manik Surtani
+ * @author Galder Zamarreño
  * @since 4.0
  */
 @Scope(Scopes.GLOBAL)
@@ -83,6 +84,16 @@
    Address getAddress();
 
    /**
+    * Retrieves the current cache instance's phyical network address. Some implementations might differentiate 
+    * between logical and physical addresses in which case, this method allows clients to query the physical one. 
+    * Implementations where logical and physical address are the same will simply return the same Address 
+    * as {@link #getAddress()}.
+    *
+    * @return an Address
+    */   
+   Address getPhysicalAddress();
+
+   /**
     * Returns a list of  members in the current cluster view.
     *
     * @return a list of members.  Typically, this would be defensively copied.

Modified: trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java	2009-11-18 15:48:58 UTC (rev 1204)
+++ trunk/core/src/main/java/org/infinispan/remoting/transport/jgroups/JGroupsTransport.java	2009-11-23 14:15:50 UTC (rev 1205)
@@ -50,7 +50,6 @@
 import org.jgroups.ExtendedMessageListener;
 import org.jgroups.JChannel;
 import org.jgroups.Message;
-import org.jgroups.PhysicalAddress;
 import org.jgroups.View;
 import org.jgroups.blocks.GroupRequest;
 import org.jgroups.blocks.RspFilter;
@@ -99,6 +98,7 @@
    Channel channel;
    boolean createdChannel = false;
    Address address;
+   Address physicalAddress;
    volatile List<Address> members = Collections.emptyList();
    volatile boolean coordinator = false;
    final Object membersListLock = new Object(); // guards members
@@ -356,8 +356,12 @@
       return address;
    }
 
-   private PhysicalAddress getPhysicalAddress() {
-      return (PhysicalAddress) channel.downcall(new Event(Event.GET_PHYSICAL_ADDRESS, channel.getAddress()));
+   public Address getPhysicalAddress() {
+      if (physicalAddress == null && channel != null) {
+         org.jgroups.Address addr = (org.jgroups.Address) channel.downcall(new Event(Event.GET_PHYSICAL_ADDRESS, channel.getAddress()));
+         physicalAddress = new JGroupsAddress(addr);
+      }
+      return physicalAddress;
    }
 
    // ------------------------------------------------------------------------------------------------------------------

Modified: trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml	2009-11-18 15:48:58 UTC (rev 1204)
+++ trunk/jopr-plugin/src/main/resources/META-INF/rhq-plugin.xml	2009-11-23 14:15:50 UTC (rev 1205)
@@ -148,6 +148,12 @@
                    description="Statistics enabled" />
            <metric property="Invalidation.Invalidations" displayName="[Invalidation] Number of invalidations" displayType="detail" units="none" dataType="measurement"
                    description="Number of invalidations" />
+           <metric property="LockManager.ConcurrencyLevel" displayName="[LockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
+                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
+           <metric property="LockManager.NumberOfLocksHeld" displayName="[LockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are held." />
+           <metric property="LockManager.NumberOfLocksAvailable" displayName="[LockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
+                   description="The number of exclusive locks that are available." />
            <metric property="CacheStore.CacheLoaderStores" displayName="[CacheStore] Number of cache stores" displayType="detail" units="none" dataType="measurement"
                    description="number of cache loader stores" />
            <metric property="CacheLoader.CacheLoaderLoads" displayName="[CacheLoader] Number of cache store loads" displayType="detail" units="none" dataType="measurement"
@@ -192,18 +198,14 @@
                    description="Number of failed replications" />
            <metric property="RpcManager.StatisticsEnabled" displayName="[RpcManager] Statistics enabled" displayType="detail" units="none" dataType="trait"
                    description="Statistics enabled" />
+           <metric property="RpcManager.PhysicalAddress" displayName="[RpcManager] Physical network address" displayType="summary" units="none" dataType="trait"
+                   description="The physical network address associated with this instance" />
            <metric property="RpcManager.ClusterSize" displayName="[RpcManager] Cluster size" displayType="summary" units="none" dataType="measurement"
                    description="Size of the cluster in number of nodes" />
            <metric property="RpcManager.SuccessRatioFloatingPoint" displayName="[RpcManager] Successful replication ratio" displayType="summary" units="percentage" dataType="measurement"
                    description="Successful replications as a ratio of total replications in numeric double format" />
            <metric property="RpcManager.AverageReplicationTime" displayName="[RpcManager] Average time spent in the transport layer" displayType="summary" units="milliseconds" dataType="measurement"
                    description="The average time spent in the transport layer, in milliseconds" />
-           <metric property="LockManager.ConcurrencyLevel" displayName="[LockManager] Concurrency level" displayType="detail" units="none" dataType="trait"
-                   description="The concurrency level that the MVCC Lock Manager has been configured with." />
-           <metric property="LockManager.NumberOfLocksHeld" displayName="[LockManager] Number of locks held" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are held." />
-           <metric property="LockManager.NumberOfLocksAvailable" displayName="[LockManager] Number of locks available" displayType="detail" units="none" dataType="measurement"
-                   description="The number of exclusive locks that are available." />
            <metric property="Cache.CacheName" displayName="[Cache] Cache name" displayType="summary" units="none" dataType="trait"
                    description="Returns the cache name" />
            <metric property="Cache.CacheStatus" displayName="[Cache] Cache status" displayType="summary" units="none" dataType="trait"



More information about the infinispan-commits mailing list