Guest User

Untitled

a guest
May 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public CompletionStage<Account> get(Long id) {
  2. return supplyAsync(() -> wrap(em -> Failsafe.with(circuitBreaker).get(() -> lookup(em, id))));
  3. }
  4.  
  5. var Q = require('q')
  6.  
  7. Q.all([ repository.get(id1), repository.get(id2) ])
  8. .then(result -> {
  9. console.log(result[0] + ' ' + result[1])
  10. })
  11.  
  12. CompletableFuture<CompletionStage<Account>> first = CompletableFuture.supplyAsync(() -> repository.get(actionActionTuple._1.getAccountId()));
  13. CompletableFuture<CompletionStage<Account>> second = CompletableFuture.supplyAsync(() -> repository.get(actionActionTuple._2.getAccountId()));
  14.  
  15. return CompletableFuture.allOf(first, second)
  16. .thenAcceptAsync(res -> {
  17. System.out.println("res = " + res);
  18. });
Add Comment
Please, Sign In to add comment