ACCUMULO-2985 Ensure that ES is properly initialized during start() By initializing the ExecutorService in the constructor, I broke the ability to stop, start, and then re-stop the minicluster. Lazily initialize the ES in start() which should alleviate the issue.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e2b2676f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e2b2676f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e2b2676f Branch: refs/heads/master Commit: e2b2676f1be20474f1e4d2af99b3747de0c7d9c1 Parents: 609c726 Author: Josh Elser <els...@apache.org> Authored: Tue Jul 15 17:23:50 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Tue Jul 15 17:23:50 2014 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/minicluster/MiniAccumuloCluster.java | 8 ++++++-- .../apache/accumulo/minicluster/CleanShutdownMacTest.java | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/e2b2676f/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java index 10fed73..b85cd87 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java @@ -298,8 +298,6 @@ public class MiniAccumuloCluster { zooCfg.store(fileWriter, null); fileWriter.close(); - - this.executor = Executors.newSingleThreadExecutor(); } /** @@ -345,6 +343,10 @@ public class MiniAccumuloCluster { masterProcess = exec(Master.class); gcProcess = exec(SimpleGarbageCollector.class); + + if (null == executor) { + executor = Executors.newSingleThreadExecutor(); + } } /** @@ -420,6 +422,8 @@ public class MiniAccumuloCluster { if (!tasksRemaining.isEmpty()) { log.warn("Unexpectedly had " + tasksRemaining.size() + " task(s) remaining in threadpool for execution when being stopped"); } + + executor = null; } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/e2b2676f/minicluster/src/test/java/org/apache/accumulo/minicluster/CleanShutdownMacTest.java ---------------------------------------------------------------------- diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/CleanShutdownMacTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/CleanShutdownMacTest.java index b22a45e..8e6e11b 100644 --- a/minicluster/src/test/java/org/apache/accumulo/minicluster/CleanShutdownMacTest.java +++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/CleanShutdownMacTest.java @@ -37,10 +37,6 @@ public class CleanShutdownMacTest { public void testExecutorServiceShutdown() throws Exception { File tmp = Files.createTempDir(); MiniAccumuloCluster cluster = new MiniAccumuloCluster(tmp, "foo"); - ExecutorService service = cluster.getShutdownExecutor(); - - // Don't leak the one that gets created - service.shutdownNow(); ExecutorService mockService = EasyMock.createMock(ExecutorService.class); Future<Integer> future = EasyMock.createMock(Future.class);