We will break down how to run one task in a single virtual thread using
Executors.newVirtualThreadPerTaskExecutor() (Java 21), how this differs from classic pools (
newFixedThreadPool,
newCachedThreadPool), how to shut down properly via
shutdown() and
awaitTermination(...), how to get task results via
Future, and where virtual threads deliver the biggest wins (mass I/O, web servers, load testing). At the end — common mistakes and gotchas.