/** {@inheritDoc} */ @Override public void stop(boolean cancel) throws IgniteCheckedException { if (!isEnabled) return; ctx.io().removeMessageListener(GridTopic.TOPIC_AUTH, ioLsnr); ctx.event().removeDiscoveryEventListener(discoLsnr, DISCO_EVT_TYPES); cancelFutures("Node stopped"); if (!cancel) exec.shutdown(); else exec.shutdownNow(); }
exec.shutdown();
/** {@inheritDoc} */ @Override public void stop(boolean cancel) throws IgniteCheckedException { if (!isEnabled) return; ctx.io().removeMessageListener(GridTopic.TOPIC_AUTH, ioLsnr); ctx.event().removeDiscoveryEventListener(discoLsnr, DISCO_EVT_TYPES); cancelFutures("Node stopped"); if (!cancel) exec.shutdown(); else exec.shutdownNow(); }
/** * @throws ExecutionException If failed. */ @Test public void testGridThreadPoolExecutorRejection() throws Exception { IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor("", "", 1, 1, 0, new LinkedBlockingQueue<Runnable>()); for (int i = 0; i < 10; i++) exec.submit(new TestRunnable()); exec.shutdown(); assert exec.awaitTermination(30, SECONDS); }
/** * @throws ExecutionException If failed. */ @Test public void testGridThreadPoolExecutor() throws Exception { IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor("", "", 1, 1, 0, new LinkedBlockingQueue<Runnable>()); exec.submit(new InterruptingRunnable()).get(); Future<Boolean> fut = exec.submit(new IsInterruptedAssertionCallable()); assert !fut.get() : "Expecting the executor to reset the interrupted flag when reinvoking the thread"; exec.shutdown(); assert exec.awaitTermination(30, SECONDS); }