Java Executor

Java ExecutorService Shutdown: shutdown() vs shutdownNow()

Shut down a Java ExecutorService with shutdown(), awaitTermination() and shutdownNow(), or with try-with-resources and close() on Java 19+. Covers queued tasks, RejectedExecutionException, virtual threads, JVM exit and shutdown hooks.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.