01: package org.testng.internal.thread;
02:
03: import java.util.concurrent.ExecutionException;
04: import java.util.concurrent.Future;
05:
06: /**
07: * A very reduced interface of <code>Future</code>.
08: *
09: * @author <a href="mailto:the_mindstorm@evolva.ro>the_mindstorm</a>
10: */
11: public class FutureResultAdapter implements IFutureResult {
12: Future<?> m_future;
13:
14: public FutureResultAdapter(Future<?> future) {
15: m_future = future;
16: }
17:
18: public Object get() throws InterruptedException,
19: ThreadExecutionException {
20: try {
21: return m_future.get();
22: } catch (ExecutionException ee) {
23: throw new ThreadExecutionException(ee.getCause()); // NOTE there is no need to keep the EE
24: }
25: }
26: }
|