private CompletionConjunctFuture(Collection<? extends CompletableFuture<?>> futuresToComplete) { numFuturesTotal = futuresToComplete.size(); futuresCompleted = 0; globalThrowable = null; if (futuresToComplete.isEmpty()) { complete(null); } else { for (CompletableFuture<?> completableFuture : futuresToComplete) { completableFuture.whenComplete(this::completeFuture); } } }
private CompletionConjunctFuture(Collection<? extends CompletableFuture<?>> futuresToComplete) { numFuturesTotal = futuresToComplete.size(); futuresCompleted = 0; globalThrowable = null; if (futuresToComplete.isEmpty()) { complete(null); } else { for (CompletableFuture<?> completableFuture : futuresToComplete) { completableFuture.whenComplete(this::completeFuture); } } }
private CompletionConjunctFuture(Collection<? extends CompletableFuture<?>> futuresToComplete) { this.futuresToComplete = checkNotNull(futuresToComplete); numFuturesTotal = futuresToComplete.size(); futuresCompleted = 0; globalThrowable = null; if (futuresToComplete.isEmpty()) { complete(null); } else { for (CompletableFuture<?> completableFuture : futuresToComplete) { completableFuture.whenComplete(this::completeFuture); } } }
private void completeFuture(Object ignored, Throwable throwable) { synchronized (lock) { futuresCompleted++; if (throwable != null) { globalThrowable = ExceptionUtils.firstOrSuppressed(throwable, globalThrowable); } if (futuresCompleted == numFuturesTotal) { if (globalThrowable != null) { completeExceptionally(globalThrowable); } else { complete(null); } } } }
private void completeFuture(Object ignored, Throwable throwable) { synchronized (lock) { futuresCompleted++; if (throwable != null) { globalThrowable = ExceptionUtils.firstOrSuppressed(throwable, globalThrowable); } if (futuresCompleted == numFuturesTotal) { if (globalThrowable != null) { completeExceptionally(globalThrowable); } else { complete(null); } } } }
private void completeFuture(Object ignored, Throwable throwable) { synchronized (lock) { futuresCompleted++; if (throwable != null) { globalThrowable = ExceptionUtils.firstOrSuppressed(throwable, globalThrowable); } if (futuresCompleted == numFuturesTotal) { if (globalThrowable != null) { completeExceptionally(globalThrowable); } else { complete(null); } } } }