Код: Выделить всё
public static void main(String[] args) {
Thread.currentThread().interrupt();
long start = System.currentTimeMillis();
System.out.println("started measuring ...");
int i = 0;
try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) {
List
Подробнее здесь: [url]https://stackoverflow.com/questions/79798851/java-thread-interrupt-non-deterministic-behaviour[/url]