hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1543138 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
Date Mon, 18 Nov 2013 20:21:27 GMT
Author: jmhsieh
Date: Mon Nov 18 20:21:27 2013
New Revision: 1543138

URL: http://svn.apache.org/r1543138
Log:
HBASE-9831 'hbasefsck.numthreads' property isn't passed to hbck via cmdline -D option (Takeshi
Miao)

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1543138&r1=1543137&r2=1543138&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
Mon Nov 18 20:21:27 2013
@@ -267,8 +267,7 @@ public class HBaseFsck extends Configure
     super(conf);
     errors = getErrorReporter(conf);
 
-    int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS);
-    executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck"));
+    initialPoolNumThreads();
   }
 
   /**
@@ -300,6 +299,18 @@ public class HBaseFsck extends Configure
   }
 
   /**
+   * Initial numThreads for {@link #executor}
+   */
+  private void initialPoolNumThreads() {
+    if (executor != null) {
+      executor.shutdown();
+    }
+  
+    int numThreads = getConf().getInt("hbasefsck.numthreads", MAX_NUM_THREADS);
+    executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck"));
+  }
+
+  /**
    * Get deployed regions according to the region servers.
    */
   private void loadDeployedRegions() throws IOException, InterruptedException {
@@ -3595,6 +3606,9 @@ public class HBaseFsck extends Configure
 
   @Override
   public int run(String[] args) throws Exception {
+    // reset the numThreads due to user may set it via generic options
+    initialPoolNumThreads();
+
     exec(executor, args);
     return getRetCode();
   }



Mime
View raw message