@Test(timeout=10000) public void testShutdownNowWithNoTasks() throws Exception { ExecutorService service = Executors.newSingleThreadExecutor(); assertNotNull(ThreadPoolUtils.shutdownNow(service)); assertTrue(service.isShutdown()); }
public static List<Runnable> shutdownNow(ExecutorService executorService) { if (executorService == null) { return Collections.emptyList(); } List<Runnable> answer = null; if (!executorService.isShutdown()) { LOG.debug("Forcing shutdown of ExecutorService: {}", executorService); answer = executorService.shutdownNow(); LOG.trace("Shutdown of ExecutorService: {} is shutdown: {} and terminated: {}.", new Object[] { executorService, executorService.isShutdown(), executorService.isTerminated() }); } if (answer == null) { answer = Collections.emptyList(); } return answer; }
ThreadPoolUtils { public static List<Runnable> shutdownNow(ExecutorService executorService) { if (executorService == null) { return Collections.emptyList(); } List<Runnable> answer = null; if (!executorService.isShutdown()) { LOG.debug("Forcing shutdown of ExecutorService: {}", executorService); answer = executorService.shutdownNow(); LOG.trace("Shutdown of ExecutorService: {} is shutdown: {} and terminated: {}.", new Object[] { executorService, executorService.isShutdown(), executorService.isTerminated() }); } if (answer == null) { answer = Collections.emptyList(); } return answer; } }
ThreadPoolUtils { public static List<Runnable> shutdownNow(ExecutorService executorService) { if (executorService == null) { return Collections.emptyList(); } List<Runnable> answer = null; if (!executorService.isShutdown()) { LOG.debug("Forcing shutdown of ExecutorService: {}", executorService); answer = executorService.shutdownNow(); LOG.trace("Shutdown of ExecutorService: {} is shutdown: {} and terminated: {}.", new Object[] { executorService, executorService.isShutdown(), executorService.isTerminated() }); } if (answer == null) { answer = Collections.emptyList(); } return answer; }  }
ThreadPoolUtils { public static List<Runnable> shutdownNow(ExecutorService executorService) { if (executorService == null) { return Collections.emptyList(); } List<Runnable> answer = null; if (!executorService.isShutdown()) { LOG.debug("Forcing shutdown of ExecutorService: {}", executorService); answer = executorService.shutdownNow(); LOG.trace("Shutdown of ExecutorService: {} is shutdown: {} and terminated: {}.", new Object[] { executorService, executorService.isShutdown(), executorService.isTerminated() }); } if (answer == null) { answer = Collections.emptyList(); } return answer; }  static void shutdown(ExecutorService executorService); static List<Runnable> shutdownNow(ExecutorService executorService); static void shutdownGraceful(ExecutorService executorService); static void shutdownGraceful(ExecutorService executorService, long shutdownAwaitTermination); static boolean awaitTermination(ExecutorService executorService, long shutdownAwaitTermination); }
ThreadPoolUtils { public static List<Runnable> shutdownNow(ExecutorService executorService) { if (executorService == null) { return Collections.emptyList(); } List<Runnable> answer = null; if (!executorService.isShutdown()) { LOG.debug("Forcing shutdown of ExecutorService: {}", executorService); answer = executorService.shutdownNow(); LOG.trace("Shutdown of ExecutorService: {} is shutdown: {} and terminated: {}.", new Object[] { executorService, executorService.isShutdown(), executorService.isTerminated() }); } if (answer == null) { answer = Collections.emptyList(); } return answer; }  static void shutdown(ExecutorService executorService); static List<Runnable> shutdownNow(ExecutorService executorService); static void shutdownGraceful(ExecutorService executorService); static void shutdownGraceful(ExecutorService executorService, long shutdownAwaitTermination); static boolean awaitTermination(ExecutorService executorService, long shutdownAwaitTermination); static final long DEFAULT_SHUTDOWN_AWAIT_TERMINATION; }