You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by to...@apache.org on 2011/10/06 02:16:45 UTC

svn commit: r1179479 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java

Author: todd
Date: Thu Oct  6 00:16:45 2011
New Revision: 1179479

URL: http://svn.apache.org/viewvc?rev=1179479&view=rev
Log:
HBASE-4386  Fix a potential NPE in TaskMonitor

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1179479&r1=1179478&r2=1179479&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Oct  6 00:16:45 2011
@@ -339,6 +339,7 @@ Release 0.92.0 - Unreleased
    HBASE-4494  AvroServer:: get fails with NPE on a non-existent row
                (Kay Kay)
    HBASE-4481  TestMergeTool failed in 0.92 build 20
+   HBASE-4386  Fix a potential NPE in TaskMonitor (todd)
 
   TESTS
    HBASE-4450  test for number of blocks read: to serve as baseline for expected

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java?rev=1179479&r1=1179478&r2=1179479&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java Thu Oct  6 00:16:45 2011
@@ -72,7 +72,9 @@ public class TaskMonitor {
         new Class<?>[] { MonitoredTask.class },
         new PassthroughInvocationHandler<MonitoredTask>(stat));
     TaskAndWeakRefPair pair = new TaskAndWeakRefPair(stat, proxy);
-    tasks.add(pair);
+    synchronized (this) {
+      tasks.add(pair);
+    }
     return proxy;
   }
 
@@ -84,7 +86,9 @@ public class TaskMonitor {
         new Class<?>[] { MonitoredRPCHandler.class },
         new PassthroughInvocationHandler<MonitoredRPCHandler>(stat));
     TaskAndWeakRefPair pair = new TaskAndWeakRefPair(stat, proxy);
-    tasks.add(pair);
+    synchronized (this) {
+      tasks.add(pair);
+    }
     return proxy;
   }
 
@@ -142,7 +146,7 @@ public class TaskMonitor {
   public void dumpAsText(PrintWriter out) {
     long now = System.currentTimeMillis();
     
-    List<MonitoredTask> tasks = TaskMonitor.get().getTasks();
+    List<MonitoredTask> tasks = getTasks();
     for (MonitoredTask task : tasks) {
       out.println("Task: " + task.getDescription());
       out.println("Status: " + task.getState() + ":" + task.getStatus());