August 2019
Intermediate to advanced
256 pages
6h 43m
English
Making an operation asynchronous is as simple as the following:
@Asynchronouspublic Future<Connection> service() throws InterruptedException { Connection conn = new Connection() { { Thread.sleep(1000); } @Override public String getData() { return "service DATA"; } }; return CompletableFuture.completedFuture(conn);}
The only constraint is to have the @Asynchronous method return Future or CompletionStage; otherwise, the implementation should throw an exception.
Read now
Unlock full access