I want to chain async rest service calls and have single callback when they finished.
Is it possible to do it with guava?
Futures.chain was removed in version 12.0. The new method of chaining together ListenableFutures is via the Futures.transform method.
Futures.chain
12.0
ListenableFutures
https://github.com/google/guava/wiki/ListenableFutureExplained#application
From Guava latest javadoc (16.0.1 as of this writing).
16.0.1
ListenableFuture<RowKey> rowKeyFuture = indexService.lookUp(query); AsyncFunction<RowKey, QueryResult> queryFunction = new AsyncFunction<RowKey, QueryResult>() { public ListenableFuture<QueryResult> apply(RowKey rowKey) { return dataService.read(rowKey); } }; ListenableFuture<QueryResult> queryFuture = transform(rowKeyFuture, queryFunction);
2.1m questions
2.1m answers
60 comments
57.0k users