java.util.concurrent · java.base · since Java 1.5

ExecutorService

declaration
public interface ExecutorService extends Executor, AutoCloseable

Task-execution service: submit Callables/Runnables, get Futures back, and shut down cleanly. The abstraction that separates what runs from how it runs (EJ 80).

Key methods

<T> Future<T> submit(Callable<T> task)Run and get a result handle.
<T> List<Future<T>> invokeAll(Collection<Callable<T>>)Run all, wait for all.
void shutdown() / List<Runnable> shutdownNow()Graceful stop-accepting / interrupt-and-drain.
boolean awaitTermination(long, TimeUnit)Wait for in-flight tasks after shutdown.
void close()AutoCloseable (Java 19): shutdown + await — try-with-resources pools.