Ensure the future is always set
@@ -108,7 +108,11 @@ public final class WorkUnitContext {
* All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the start.
*/
public void synchronizeStart() throws InterruptedException {
+ // Let code waiting for the start (future.start.get()) finishes when there is a faulty SubTask by setting the
+ // future always.
+ try {
startLatch.synchronize();
+ } finally {
// the main thread will send a notification
Executor e = Executor.currentExecutor();
WorkUnit wu = e.getCurrentWorkUnit();
@@ -116,6 +120,7 @@ public final class WorkUnitContext {
future.start.set(e.getCurrentExecutable());
}
}
+ }
@Deprecated
public void synchronizeEnd(Queue.Executable executable, Throwable problems, long duration) throws InterruptedException {
@@ -130,8 +135,11 @@ public final class WorkUnitContext {
* the member threads will report {@link InterruptedException}.
*/
public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException {
+ // Let code waiting for the build to finish (future.get()) finishes when there is a faulty SubTask by setting
+ // the future always.
+ try {
endLatch.synchronize();
-
+ } finally {
// the main thread will send a notification
WorkUnit wu = e.getCurrentWorkUnit();
if (wu.isMainWork()) {
@@ -144,6 +152,7 @@ public final class WorkUnitContext {
}
}
}
+ }
/**
* When one of the work unit is aborted, call this method to abort all the other work units.
