HBASE-14654 Reenable TestMultiParallel#testActiveThreadsCount

This commit is contained in:
chenheng 2015-12-22 11:33:25 +08:00
parent 9a297ef0a5
commit f018c371b5
2 changed files with 5 additions and 3 deletions

View File

@ -128,14 +128,15 @@ public class HTable implements HTableInterface {
if (maxThreads == 0) {
maxThreads = 1; // is there a better default?
}
int corePoolSize = conf.getInt("hbase.htable.threads.coresize", 1);
long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime", 60);
// Using the "direct handoff" approach, new threads will only be created
// if it is necessary and will grow unbounded. This could be bad but in HCM
// we only create as many Runnables as there are region servers. It means
// it also scales when new region servers are added.
ThreadPoolExecutor pool = new ThreadPoolExecutor(1, maxThreads, keepAliveTime, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("htable"));
ThreadPoolExecutor pool = new ThreadPoolExecutor(corePoolSize, maxThreads, keepAliveTime,
TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("htable"));
pool.allowCoreThreadTimeOut(true);
return pool;
}

View File

@ -144,8 +144,9 @@ public class TestMultiParallel {
* @throws NoSuchFieldException
* @throws SecurityException
*/
@Ignore ("Nice bug flakey... expected 5 but was 4..") @Test(timeout=300000)
@Test(timeout=300000)
public void testActiveThreadsCount() throws Exception {
UTIL.getConfiguration().setLong("hbase.htable.threads.coresize", slaves + 1);
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration())) {
ThreadPoolExecutor executor = HTable.getDefaultExecutor(UTIL.getConfiguration());
try {