Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.tests/src/org')
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index 950d8db519..143b436b09 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -946,4 +946,53 @@ public abstract class AbstractOMTest extends TestCase
return !latch.await(timeoutMillis, TimeUnit.MILLISECONDS);
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static abstract class ThreadTimeOuter extends LatchTimeOuter implements Runnable
+ {
+ private RuntimeException exception;
+
+ public ThreadTimeOuter()
+ {
+ super(1);
+ }
+
+ @Override
+ public boolean timedOut(long timeoutMillis) throws InterruptedException
+ {
+ Thread thread = new Thread(this, "ThreadTimeOuter")
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ ThreadTimeOuter.this.run();
+ }
+ catch (RuntimeException ex)
+ {
+ exception = ex;
+ }
+ finally
+ {
+ countDown();
+ }
+ }
+ };
+
+ thread.setDaemon(true);
+ thread.start();
+
+ boolean result = super.timedOut(timeoutMillis);
+
+ if (exception != null)
+ {
+ throw exception;
+ }
+
+ return result;
+ }
+ }
}

Back to the top