HBASE-7300 HbckTestingUtil needs to keep a static executor to lower the number of threads used

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1418571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2012-12-08 00:46:56 +00:00
parent f8cb35d156
commit d440c135ef
1 changed files with 2 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import org.apache.hadoop.hbase.util.HBaseFsck;
import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE; import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE;
public class HbckTestingUtil { public class HbckTestingUtil {
private static ExecutorService exec = new ScheduledThreadPoolExecutor(10);
public static HBaseFsck doFsck( public static HBaseFsck doFsck(
Configuration conf, boolean fix) throws Exception { Configuration conf, boolean fix) throws Exception {
return doFsck(conf, fix, null); return doFsck(conf, fix, null);
@ -44,7 +45,7 @@ public class HbckTestingUtil {
boolean fixMeta, boolean fixHdfsHoles, boolean fixHdfsOverlaps, boolean fixMeta, boolean fixHdfsHoles, boolean fixHdfsOverlaps,
boolean fixHdfsOrphans, boolean fixTableOrphans, boolean fixVersionFile, boolean fixHdfsOrphans, boolean fixTableOrphans, boolean fixVersionFile,
String table) throws Exception { String table) throws Exception {
HBaseFsck fsck = new HBaseFsck(conf); HBaseFsck fsck = new HBaseFsck(conf, exec);
fsck.connect(); fsck.connect();
fsck.setDisplayFullReport(); // i.e. -details fsck.setDisplayFullReport(); // i.e. -details
fsck.setTimeLag(0); fsck.setTimeLag(0);
@ -71,7 +72,6 @@ public class HbckTestingUtil {
*/ */
public static HBaseFsck doHFileQuarantine(Configuration conf, String table) throws Exception { public static HBaseFsck doHFileQuarantine(Configuration conf, String table) throws Exception {
String[] args = {"-sidelineCorruptHFiles", "-ignorePreCheckPermission", table}; String[] args = {"-sidelineCorruptHFiles", "-ignorePreCheckPermission", table};
ExecutorService exec = new ScheduledThreadPoolExecutor(10);
HBaseFsck hbck = new HBaseFsck(conf, exec); HBaseFsck hbck = new HBaseFsck(conf, exec);
hbck.exec(exec, args); hbck.exec(exec, args);
return hbck; return hbck;