Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-12-08 12:09:07 -0500
committerThomas Watson2011-12-08 12:09:07 -0500
commitca9cd6190f64ff79cf4b61c317d3124be64251f5 (patch)
tree464f88bcdd4889161e8f3032c19c23e432f89ca9
parentaefd5bd422b0f347c291f061805e0468f975d8ff (diff)
downloadrt.equinox.framework-ca9cd6190f64ff79cf4b61c317d3124be64251f5.tar.gz
rt.equinox.framework-ca9cd6190f64ff79cf4b61c317d3124be64251f5.tar.xz
rt.equinox.framework-ca9cd6190f64ff79cf4b61c317d3124be64251f5.zip
Bug 366051 - org.eclipse.osgi.tests.bundles.TestResults does not handle
spurious wakes
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/TestResults.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/TestResults.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/TestResults.java
index 9216773f2..8993b5a1f 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/TestResults.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/TestResults.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,14 +11,17 @@
package org.eclipse.osgi.tests.bundles;
import java.util.ArrayList;
+
public class TestResults {
ArrayList events = new ArrayList();
-
+
synchronized public void addEvent(Object event) {
events.add(event);
notifyAll();
}
+
synchronized public Object[] getResults(int expectedResultsNumber) {
+ long initialTime = System.currentTimeMillis();
while (events.size() < expectedResultsNumber) {
int currentSize = events.size();
try {
@@ -26,7 +29,7 @@ public class TestResults {
} catch (InterruptedException e) {
// do nothing
}
- if (currentSize == events.size())
+ if (currentSize == events.size() && (System.currentTimeMillis() - initialTime) >= 5000)
break; // no new events occurred; break out
}
Object[] result = events.toArray();

Back to the top