| 18 | } |
| 19 | |
| 20 | private static void isDoneTest(final boolean throwException) { |
| 21 | RunnableFuture<?> future = new FutureTask<Object>(new Runnable() { |
| 22 | @Override |
| 23 | public void run() { |
| 24 | if (throwException) { |
| 25 | throw new RuntimeException(); |
| 26 | } |
| 27 | } |
| 28 | }, null); |
| 29 | |
| 30 | // should finish the future |
| 31 | future.run(); |
| 32 | |
| 33 | if (! future.isDone()) { |
| 34 | throw new RuntimeException("Future should be done"); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | private static void getCallableResultTest() throws InterruptedException, ExecutionException { |
| 39 | final Object result = new Object(); |