Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public CompletableFuture<File> processDownload( final FileDownload fileDownload ) {
- Objects.requireNonNull( fileDownload );
- fileDownload.setDirectory( getTmpDirectoryPath() );
- CompletableFuture<File> future = CompletableFuture.supplyAsync( fileDownload, executorService );
- future... throwable -> {
- if ( throwable != null ) {
- logError( throwable );
- }
- ...
- return null; // client won't receive file.
- } );
- return future;
- }
- future = future.whenComplete((t, ex) -> {
- if (ex != null) {
- logException(ex);
- }
- });
- future = future.handle((t, ex) -> {
- if (ex != null) {
- logException(ex);
- return null;
- } else {
- return t;
- }
- });
- future = future.exceptionally(ex -> {
- logException(ex);
- return null;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement