@After public void teardown() throws Exception { if (executorService != null) { executorService.shutdown(); } TEST_UTIL.shutdownMiniZKCluster(); }
@Test public void testAborting() throws Exception { final Configuration conf = HBaseConfiguration.create(); final Server server = mock(Server.class); when(server.getConfiguration()).thenReturn(conf); ExecutorService executorService = new ExecutorService("unit_test"); executorService.startExecutorService( ExecutorType.MASTER_SERVER_OPERATIONS, 1); executorService.submit(new EventHandler(server, EventType.M_SERVER_SHUTDOWN) { @Override public void process() throws IOException { throw new RuntimeException("Should cause abort"); } }); Waiter.waitFor(conf, 30000, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception { try { verify(server, times(1)).abort(anyString(), (Throwable) anyObject()); return true; } catch (Throwable t) { return false; } } }); executorService.shutdown(); }
assertEquals(maxThreads, pool.getPoolSize()); executorService.shutdown();
this.compactSplitThread.join(); if (this.executorService != null) this.executorService.shutdown(); if (this.replicationSourceHandler != null && this.replicationSourceHandler == this.replicationSinkHandler) {
private void stopServiceThreads() { if (LOG.isDebugEnabled()) { LOG.debug("Stopping service threads"); } if (this.rpcServer != null) this.rpcServer.stop(); // Clean up and close up shop if (this.logCleaner!= null) this.logCleaner.interrupt(); if (this.hfileCleaner != null) this.hfileCleaner.interrupt(); if (this.infoServer != null) { LOG.info("Stopping infoServer"); try { this.infoServer.stop(); } catch (Exception ex) { ex.printStackTrace(); } } if (this.executorService != null) this.executorService.shutdown(); if (this.healthCheckChore != null) { this.healthCheckChore.interrupt(); } }
@After public void teardown() throws Exception { if (executorService != null) { executorService.shutdown(); } TEST_UTIL.shutdownMiniZKCluster(); }
@Test public void testAborting() throws Exception { final Configuration conf = HBaseConfiguration.create(); final Server server = mock(Server.class); when(server.getConfiguration()).thenReturn(conf); ExecutorService executorService = new ExecutorService("unit_test"); executorService.startExecutorService( ExecutorType.MASTER_SERVER_OPERATIONS, 1); executorService.submit(new EventHandler(server, EventType.M_SERVER_SHUTDOWN) { @Override public void process() throws IOException { throw new RuntimeException("Should cause abort"); } }); Waiter.waitFor(conf, 30000, new Predicate<Exception>() { @Override public boolean evaluate() throws Exception { try { verify(server, times(1)).abort(anyString(), (Throwable) anyObject()); return true; } catch (Throwable t) { return false; } } }); executorService.shutdown(); }
assertEquals(maxThreads, pool.getPoolSize()); executorService.shutdown();
/** * Wait on all threads to finish. Presumption is that all closes and stops * have already been called. */ protected void join() { Threads.shutdown(this.compactionChecker.getThread()); Threads.shutdown(this.cacheFlusher.getThread()); if (this.healthCheckChore != null) { Threads.shutdown(this.healthCheckChore.getThread()); } if (this.hlogRoller != null) { Threads.shutdown(this.hlogRoller.getThread()); } if (this.compactSplitThread != null) { this.compactSplitThread.join(); } if (this.service != null) this.service.shutdown(); if (this.replicationSourceHandler != null && this.replicationSourceHandler == this.replicationSinkHandler) { this.replicationSourceHandler.stopReplicationService(); } else if (this.replicationSourceHandler != null) { this.replicationSourceHandler.stopReplicationService(); } else if (this.replicationSinkHandler != null) { this.replicationSinkHandler.stopReplicationService(); } }
this.compactSplitThread.join(); if (this.service != null) this.service.shutdown(); if (this.replicationSourceHandler != null && this.replicationSourceHandler == this.replicationSinkHandler) {