Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-03-19 18:16:34 +0000
committerSteffen Pingel2012-03-19 18:16:34 +0000
commitb878a512568c771c5f0ee041b3bbf4ebe84f7897 (patch)
treec27d58cd5dfe26214d08cdb568a6b2150ca0cecf
parent81f3e14adea3d49f03b68b56079616a900d23a9c (diff)
downloadorg.eclipse.mylyn.commons-b878a512568c771c5f0ee041b3bbf4ebe84f7897.tar.gz
org.eclipse.mylyn.commons-b878a512568c771c5f0ee041b3bbf4ebe84f7897.tar.xz
org.eclipse.mylyn.commons-b878a512568c771c5f0ee041b3bbf4ebe84f7897.zip
wait for thread pool to be idle before executing testsR_3_7_0
-rw-r--r--org.eclipse.mylyn.commons.core/src/org/eclipse/mylyn/commons/core/operations/OperationUtil.java1
-rw-r--r--org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/net/WebUtilTest.java7
2 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.commons.core/src/org/eclipse/mylyn/commons/core/operations/OperationUtil.java b/org.eclipse.mylyn.commons.core/src/org/eclipse/mylyn/commons/core/operations/OperationUtil.java
index 6288f6a1..a154b860 100644
--- a/org.eclipse.mylyn.commons.core/src/org/eclipse/mylyn/commons/core/operations/OperationUtil.java
+++ b/org.eclipse.mylyn.commons.core/src/org/eclipse/mylyn/commons/core/operations/OperationUtil.java
@@ -103,6 +103,7 @@ public class OperationUtil {
try {
return future.get(POLL_INTERVAL, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
+ // XXX this hides the original stack trace from the caller invoking execute()
throw e.getCause();
} catch (TimeoutException ignored) {
}
diff --git a/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/net/WebUtilTest.java b/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/net/WebUtilTest.java
index 2e196e28..3dd99a0b 100644
--- a/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/net/WebUtilTest.java
+++ b/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/net/WebUtilTest.java
@@ -234,6 +234,13 @@ public class WebUtilTest extends TestCase {
}
public void testReadTimeout() throws Exception {
+ // wait 5 seconds for thread pool to be idle
+ for (int i = 0; i < 10; i++) {
+ if (((ThreadPoolExecutor) CommonsNetPlugin.getExecutorService()).getActiveCount() == 0) {
+ break;
+ }
+ Thread.sleep(500);
+ }
assertEquals(0, ((ThreadPoolExecutor) CommonsNetPlugin.getExecutorService()).getActiveCount());
String url = "http://" + proxyAddress.getHostName() + ":" + proxyAddress.getPort() + "/";

Back to the top