Last active
December 4, 2018 10:56
-
-
Save david-romero/f843d0b2e9e098600db29f3bc25ec563 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<CompletableFuture<Void>> futureList = getAllFuture(); | |
CompletableFuture<Void> allFutureTogether = CompletableFuture.allOf(futureList.toArray()); | |
allFutureTogether.whenComplete( (voidObject, error) -> { | |
if ( error == null ){ | |
// all future ended successfully | |
List<Correo> copyOfCorreos = new ArrayList<>(procesar); | |
Correo lastCorreo = getLastSentCorreo(copyOfCorreos); | |
configuracionCorreoService.save(lastCorreo); | |
} else { | |
// some thread has ended with error.... should I send an email with the error? | |
log.error("OOPPS", error); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment