By using Executors.newVirtualThreadPerTaskExecutor().
Java's ExecutorService can create and manage Virtual Threads using Executors.newVirtualThreadPerTaskExecutor(), which provides an efficient way to handle tasks without the overhead of traditional thread management. This is beneficial in high-concurrency environments such as an e-commerce platform during a flash sale, where tasks can be executed as Virtual Threads without blocking OS resources.
Additional Notes
How does Java’s ExecutorService handle Virtual Threads?