01: package org.testng.internal.thread.port;
02:
03: import org.testng.internal.thread.IFutureResult;
04: import org.testng.internal.thread.ThreadExecutionException;
05:
06: import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException;
07: import edu.emory.mathcs.backport.java.util.concurrent.Future;
08:
09: /**
10: * IFutureResult implementation and Future adapter.
11: *
12: * @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a>
13: */
14: public class FutureResultAdapter implements IFutureResult {
15: Future m_future;
16:
17: public FutureResultAdapter(Future future) {
18: m_future = future;
19: }
20:
21: public Object get() throws InterruptedException,
22: ThreadExecutionException {
23: try {
24: return m_future.get();
25: } catch (ExecutionException ee) {
26: throw new ThreadExecutionException(ee.getCause());
27: }
28: }
29: }
|