Skip to content

Commit 80b1f0a

Browse files
vogellaclaude
andcommitted
Improve barrier synchronization in ParallelBuildChainTest with shared timeout
Refactors the job synchronization logic to use a shared timeout when waiting for all jobs to reach running state, rather than waiting sequentially for each barrier. Adds a non-blocking getStatus() method to TestBarrier2 to support this more efficient synchronization approach. Fixes #825 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ea3b74f commit 80b1f0a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/ParallelBuildChainTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,9 @@ protected IStatus run(IProgressMonitor monitor) {
447447
job.setJobGroup(jobGroup);
448448
job.schedule();
449449
}
450-
for (TestBarrier2 barrier : waitForRunningJobBarriers.values()) {
451-
barrier.waitForStatus(TestBarrier2.STATUS_RUNNING);
452-
}
450+
// Wait for all job wrappers to reach running state with a shared timeout
451+
waitForCondition(() -> waitForRunningJobBarriers.values().stream()
452+
.allMatch(barrier -> barrier.getStatus() == TestBarrier2.STATUS_RUNNING), TIMEOUT_IN_MILLIS);
453453
try {
454454
executeWhileRunningBuild.run();
455455
} finally {

runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/TestBarrier2.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ public TestBarrier2(AtomicIntegerArray location, int index) {
183183
this.myIndex = index;
184184
}
185185

186+
/**
187+
* Gets this barrier object's current status.
188+
*/
189+
public int getStatus() {
190+
return myStatus.get(myIndex);
191+
}
192+
186193
/**
187194
* Sets this barrier object's status.
188195
*/

0 commit comments

Comments
 (0)