Question I've had for years: In this pseudocode,
ExecutorService svc = Executors.newFixedThreadPool(3);
svc.submit(new Runnable() { /* code A */ });
svc.shutdown();
if(svc.awaitTermination(...)) {
// code B
.awaitTermination()
is not documented as establishing happens-before between code A & B. Is there a reason it isn't ?
The ExecutorService and concurrent package javadocs define happens-before between the tasks and work done before they were submitted, but not between executor tasks and code after a successful .awaitTermination()
call.
Note, I'm not asking for design critiques on how to restructure my code to leverage documented happens-before relationships. My question here is, is there a reason the docs don't mention happens-before in this situation?
(Note that this is not a duplicate of 22665198 despite the very apt title.)