/** * Shutdown all executors associated with this runtime. * If force terminate is specified, it will forcefully terminate * the executors, otherwise it will simply signal that they * should terminate. * * @param forceTerminate Specify if the executors should be * forcefully terminated, or simply notified to shutdown when ready. */ public void shutdownExecutors(final boolean forceTerminate) { checkThread(); if (executors == null) { return; } for (V8Executor executor : executors.values()) { if (forceTerminate) { executor.forceTermination(); } else { executor.shutdown(); } } }
/** * Shutdown all executors associated with this runtime. * If force terminate is specified, it will forcefully terminate * the executors, otherwise it will simply signal that they * should terminate. * * @param forceTerminate Specify if the executors should be * forcefully terminated, or simply notified to shutdown when ready. */ public void shutdownExecutors(final boolean forceTerminate) { checkThread(); if (executors == null) { return; } for (V8Executor executor : executors.values()) { if (forceTerminate) { executor.forceTermination(); } else { executor.shutdown(); } } }
@Test public void testShutdownDoesNotTerminateLongRunningTask() throws InterruptedException { V8Executor executor = new V8Executor("while(true)", true, "messageHandler"); executor.shutdown(); assertFalse(executor.hasTerminated()); executor.forceTermination(); executor.join(); }
/** * Shutdown all executors associated with this runtime. * If force terminate is specified, it will forcefully terminate * the executors, otherwise it will simply signal that they * should terminate. * * @param forceTerminate Specify if the executors should be * forcefully terminated, or simply notified to shutdown when ready. */ public void shutdownExecutors(final boolean forceTerminate) { checkThread(); if (executors == null) { return; } for (V8Executor executor : executors.values()) { if (forceTerminate) { executor.forceTermination(); } else { executor.shutdown(); } } }
/** * Shutdown all executors associated with this runtime. * If force terminate is specified, it will forcefully terminate * the executors, otherwise it will simply signal that they * should terminate. * * @param forceTerminate Specify if the executors should be * forcefully terminated, or simply notified to shutdown when ready. */ public void shutdownExecutors(final boolean forceTerminate) { checkThread(); if (executors == null) { return; } for (V8Executor executor : executors.values()) { if (forceTerminate) { executor.forceTermination(); } else { executor.shutdown(); } } }