You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2011/08/20 22:48:19 UTC

svn commit: r1159915 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java

Author: apurtell
Date: Sat Aug 20 20:48:19 2011
New Revision: 1159915

URL: http://svn.apache.org/viewvc?rev=1159915&view=rev
Log:
HBASE-4230 Compaction threads need names

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1159915&r1=1159914&r2=1159915&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sat Aug 20 20:48:19 2011
@@ -385,6 +385,7 @@ Release 0.91.0 - Unreleased
                not shown (Nileema Shingte)
    HBASE-4229  Replace Jettison JSON encoding with Jackson in HLogPrettyPrinter
                (Riley Patterson)
+   HBASE-4230  Compaction threads need names
 
   TASKS
    HBASE-3559  Move report of split to master OFF the heartbeat channel

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=1159915&r1=1159914&r2=1159915&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java Sat Aug 20 20:48:19 2011
@@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.regionse
 import java.util.concurrent.Executors;
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
@@ -60,7 +61,7 @@ public class CompactSplitThread implemen
    * stop splitting after number of online regions is greater than this.
    */
   private int regionSplitLimit;
-
+  
   /** @param server */
   CompactSplitThread(HRegionServer server) {
     super();
@@ -90,20 +91,46 @@ public class CompactSplitThread implemen
     // if we have throttle threads, make sure the user also specified size
     Preconditions.checkArgument(smallThreads == 0 || throttleSize > 0);
 
+    final String n = Thread.currentThread().getName();
+
     this.largeCompactions = new ThreadPoolExecutor(largeThreads, largeThreads,
-        60, TimeUnit.SECONDS, new PriorityBlockingQueue<Runnable>());
+        60, TimeUnit.SECONDS, new PriorityBlockingQueue<Runnable>(), 
+        new ThreadFactory() {
+          @Override
+          public Thread newThread(Runnable r) {
+            Thread t = new Thread(r);
+            t.setName(n + "-largeCompactions-" + System.currentTimeMillis());
+            return t;
+          }
+      });
     this.largeCompactions
         .setRejectedExecutionHandler(new CompactionRequest.Rejection());
     if (smallThreads <= 0) {
       this.smallCompactions = null;
     } else {
       this.smallCompactions = new ThreadPoolExecutor(smallThreads, smallThreads,
-          60, TimeUnit.SECONDS, new PriorityBlockingQueue<Runnable>());
+          60, TimeUnit.SECONDS, new PriorityBlockingQueue<Runnable>(),
+          new ThreadFactory() {
+            @Override
+            public Thread newThread(Runnable r) {
+              Thread t = new Thread(r);
+              t.setName(n + "-smallCompactions-" + System.currentTimeMillis());
+              return t;
+            }
+        });
       this.smallCompactions
           .setRejectedExecutionHandler(new CompactionRequest.Rejection());
     }
-    this.splits = (ThreadPoolExecutor) Executors
-        .newFixedThreadPool(splitThreads);
+    this.splits = (ThreadPoolExecutor)
+        Executors.newFixedThreadPool(splitThreads,
+            new ThreadFactory() {
+          @Override
+          public Thread newThread(Runnable r) {
+            Thread t = new Thread(r);
+            t.setName(n + "-splits-" + System.currentTimeMillis());
+            return t;
+          }
+      });
   }
 
   @Override