diff options
author | Eike Stepper | 2015-08-13 16:19:08 +0000 |
---|---|---|
committer | Eike Stepper | 2015-08-13 16:19:08 +0000 |
commit | 676c0d16fbc97909ca7d5eabf50c4dccba94615a (patch) | |
tree | f346369079a9da6be0b1ab59043c19bec20f6606 /plugins/org.eclipse.net4j.tests/src/org/eclipse | |
parent | 9e42d1e8f68b55e5ec227fe4039f15fb4be3fc18 (diff) | |
download | cdo-676c0d16fbc97909ca7d5eabf50c4dccba94615a.tar.gz cdo-676c0d16fbc97909ca7d5eabf50c4dccba94615a.tar.xz cdo-676c0d16fbc97909ca7d5eabf50c4dccba94615a.zip |
[474919] RecoveringExceptionHandler swallows non-transport exceptions
https://bugs.eclipse.org/bugs/show_bug.cgi?id=474919
Diffstat (limited to 'plugins/org.eclipse.net4j.tests/src/org/eclipse')
-rw-r--r-- | plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java | 49 |
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; + } + } } |