Github user poornachandra commented on a diff in the pull request: https://github.com/apache/incubator-tephra/pull/32#discussion_r100208194 --- Diff: tephra-hbase-compat-1.1-base/src/test/java/org/apache/tephra/hbase/txprune/PruneUpperBoundWriterSupplierTest.java --- @@ -74,30 +81,35 @@ public Void call() throws Exception { futureList.clear(); numOps.set(NUM_OPS); // Start thread that release PruneUpperBoundWriters - executor = Executors.newFixedThreadPool(3); - for (int i = 0; i < 3; i++) { - futureList.add(executor.submit(new Callable<Void>() { + executor = Executors.newFixedThreadPool(NUM_THREADS); + for (int i = 0; i < NUM_THREADS; i++) { + futureList.add(executor.submit(new Runnable() { @Override - public Void call() throws Exception { + public void run() { // We need to release all NUM_OPS 'gets' that were executed to trigger shutdown of the single instance of // PruneUpperBoundWriter - while (numOps.decrementAndGet() >= 0) { + while (numOps.decrementAndGet() > 0) { supplier.release(); - TimeUnit.MICROSECONDS.sleep(random.nextInt(10)); + try { + TimeUnit.MICROSECONDS.sleep(random.nextInt(10)); + } catch (InterruptedException e) { + LOG.warn("Received an exception.", e); + } } - return null; } })); } for (Future future : futureList) { future.get(1, TimeUnit.SECONDS); } + // Since we got one instance in the beginning, we need to release it + supplier.release(); --- End diff -- It would be good to assert that the writer is running and alive before we do the final release
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---