HBASE-9831 'hbasefsck.numthreads' property isn't passed to hbck via cmdline -D option (Takeshi Miao)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1543137 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2013-11-18 20:21:25 +00:00
parent 76e1e210ea
commit 4aa3600b7c
1 changed files with 16 additions and 2 deletions

View File

@ -267,8 +267,7 @@ public class HBaseFsck extends Configured implements Tool {
super(conf);
errors = getErrorReporter(conf);
int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS);
executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck"));
initialPoolNumThreads();
}
/**
@ -299,6 +298,18 @@ public class HBaseFsck extends Configured implements Tool {
connection = admin.getConnection();
}
/**
* 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.
*/
@ -3596,6 +3607,9 @@ public class HBaseFsck extends Configured implements Tool {
@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();
}