hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1548802 - in /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver: ReplicationSource.java ReplicationSourceMetrics.java ReplicationStatistics.java
Date Sat, 07 Dec 2013 07:26:17 GMT
Author: larsh
Date: Sat Dec  7 07:26:17 2013
New Revision: 1548802

URL: http://svn.apache.org/r1548802
Log:
HBASE-10093 Unregister ReplicationSource metric bean when the replication source thread is
terminated (cuijianwei)

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationStatistics.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java?rev=1548802&r1=1548801&r2=1548802&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
Sat Dec  7 07:26:17 2013
@@ -443,6 +443,7 @@ public class ReplicationSource extends T
         LOG.debug("Attempt to close connection failed", e);
       }
     }
+    metrics.stopReportMetrics();
     LOG.debug("Source exiting " + peerId);
   }
 

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java?rev=1548802&r1=1548801&r2=1548802&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceMetrics.java
Sat Dec  7 07:26:17 2013
@@ -38,6 +38,7 @@ import org.apache.hadoop.metrics.util.Me
 public class ReplicationSourceMetrics implements Updater {
   private final MetricsRecord metricsRecord;
   private MetricsRegistry registry = new MetricsRegistry();
+  private ReplicationStatistics replicationStatistics;
 
   /** Rate of shipped operations by the source */
   public final MetricsRate shippedOpsRate =
@@ -87,7 +88,7 @@ public class ReplicationSourceMetrics im
       id = "CAN'T ENCODE UTF8";
     }
     // export for JMX
-    new ReplicationStatistics(this.registry, "ReplicationSource for " + id);
+    replicationStatistics = new ReplicationStatistics(this.registry, "ReplicationSource for
" + id);
   }
 
   /**
@@ -121,4 +122,10 @@ public class ReplicationSourceMetrics im
     }
     this.metricsRecord.update();
   }
+  
+  public void stopReportMetrics() {
+    if (this.replicationStatistics != null) {
+      this.replicationStatistics.unRegisterMBean();
+    }
+  }
 }

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationStatistics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationStatistics.java?rev=1548802&r1=1548801&r2=1548802&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationStatistics.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationStatistics.java
Sat Dec  7 07:26:17 2013
@@ -42,4 +42,10 @@ public class ReplicationStatistics exten
     super(registry, name);
     mbeanName = MBeanUtil.registerMBean("Replication", name, this);
   }
+  
+  public void unRegisterMBean() {
+    if (mbeanName != null) {
+      MBeanUtil.unregisterMBean(mbeanName);
+    }
+  }
 }



Mime
View raw message