1package org.testng.internal.thread;
2
3
4import java.util.concurrent.ExecutionException;
5import java.util.concurrent.Future;
6
7/**
8 * A very reduced interface of <code>Future</code>.
9 *
10 * @author <a href="mailto:the_mindstorm@evolva.ro>the_mindstorm</a>
11 */
12public class FutureResultAdapter implements IFutureResult {
13   Future<?> m_future;
14
15   public FutureResultAdapter(Future<?> future) {
16      m_future = future;
17   }
18
19   @Override
20  public Object get() throws InterruptedException, ThreadExecutionException {
21      try {
22         return m_future.get();
23      }
24      catch(ExecutionException ee) {
25         throw new ThreadExecutionException(ee.getCause()); // NOTE there is no need to keep the EE
26      }
27   }
28}