@Test public void testAsyncResult() throws Exception { Future<String> future = a.asyncResult(); String result = future.get(); assertEquals("foo", result); }
@Async public Future<String> asyncResult(){ try { Thread.sleep(2_000); } catch (InterruptedException e) { } return new AsyncResult<>("foo"); }
AsyncService { @Async public Future<String> asyncResult(){ try { Thread.sleep(2_000); } catch (InterruptedException e) { } return new AsyncResult<>("foo"); } }
AsyncService { @Async public Future<String> asyncResult(){ try { Thread.sleep(2_000); } catch (InterruptedException e) { } return new AsyncResult<>("foo"); }  }
AsyncService { @Async public Future<String> asyncResult(){ try { Thread.sleep(2_000); } catch (InterruptedException e) { } return new AsyncResult<>("foo"); }  int getX(); void setX(int x); @Async void compute(); @Async Future<String> asyncResult(); }
AsyncService { @Async public Future<String> asyncResult(){ try { Thread.sleep(2_000); } catch (InterruptedException e) { } return new AsyncResult<>("foo"); }  int getX(); void setX(int x); @Async void compute(); @Async Future<String> asyncResult();  }