Remove non-scheduled local dynamic jobs from waiting queue when they are done.
@@ -232,13 +232,13 @@ public class DynamicSpawnStrategy implements SpawnStrategy {
options,
ignoreFailureCheck,
delayLocalExecution);
-
localBranch.prepareFuture(remoteBranch);
remoteBranch.prepareFuture(localBranch);
synchronized (waitingLocalJobs) {
waitingLocalJobs.add(localBranch);
- }
tryScheduleLocalJob();
+ }
+
remoteBranch.execute(executorService);
try {
@@ -246,14 +246,12 @@ public class DynamicSpawnStrategy implements SpawnStrategy {
} finally {
checkState(localBranch.isDone());
checkState(remoteBranch.isDone());
- if (!waitingLocalJobs.contains(localBranch)) {
synchronized (waitingLocalJobs) {
- if (!waitingLocalJobs.contains(localBranch)) {
+ if (!waitingLocalJobs.remove(localBranch)) {
threadLimiter.release();
tryScheduleLocalJob();
}
}
- }
logger.atInfo().atMostEvery(1, TimeUnit.SECONDS).log(
"Dynamic execution of %s ended with local %s, remote %s%n",
spawn.getResourceOwner().prettyPrint(),
