A shutdown task can still succeed ?
Remi Forax
forax at univ-mlv.fr
Tue Feb 8 14:11:31 UTC 2022
Hi all,
try (var scope = new StructuredTaskScope<>()) {
var future1 = scope.fork(() -> {
Thread.sleep(1_000);
return "task1";
});
var future2 = scope.fork(() -> {
Thread.sleep(50);
scope.shutdown(); // explicit shutdown`
return "task2";
});
scope.join();
System.out.println("state1 " + future1.state());
System.out.println("state2 " + future2.state());
}
prints
state1 FAILED
state2 SUCCESS
which is surprising !
regards,
Rémi
More information about the loom-dev
mailing list