diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/ParallelBuildChainTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/ParallelBuildChainTest.java index 45ca950e3ec..4fd4c329220 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/ParallelBuildChainTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/ParallelBuildChainTest.java @@ -51,7 +51,7 @@ public class ParallelBuildChainTest extends AbstractBuilderTest { private static final int MAXIMUM_NUMBER_OF_CONCURRENT_BUILDS = 3; - private static final int TIMEOUT_IN_MILLIS = 60_000; + private static final int TIMEOUT_IN_MILLIS = 20_000; private static enum BuildDurationType { /* diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java index 6545c6e2ac6..2d6325b85bc 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/builders/TimerBuilder.java @@ -36,6 +36,8 @@ public class TimerBuilder extends IncrementalProjectBuilder { public static final String DURATION_ARG = "duration"; public static final String RULE_TYPE_ARG = "ruleType"; + private static final int SHUTDOWN_TIMEOUT_IN_MILLIS = 60_000; + private static BuildExecutionState executionState = new BuildExecutionState(-1); private static class BuildExecutionState { @@ -72,11 +74,14 @@ private synchronized void endedExcecutingProject(IProject project) { private synchronized void abortAndWaitForAllBuilds() { shallAbort = true; - while (isExecuting()) { + long durationInMillis = 0; + long waitingStartTimeInMillis = System.currentTimeMillis(); + while (isExecuting() && durationInMillis < SHUTDOWN_TIMEOUT_IN_MILLIS) { try { - wait(); + wait(SHUTDOWN_TIMEOUT_IN_MILLIS); } catch (InterruptedException e) { } + durationInMillis = System.currentTimeMillis() - waitingStartTimeInMillis; } }