Combine nested if statements

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2023-01-04 19:30:02 -05:00 committed by Alejandro García
parent 7c1c35f6e1
commit 533be5a1ca
No known key found for this signature in database
GPG key ID: F806F422E222AA02

View file

@ -60,15 +60,12 @@ public class PriceRequest {
if (!shutDownRequested) { if (!shutDownRequested) {
resultFuture.set(marketPriceTuple); resultFuture.set(marketPriceTuple);
} }
} }
public void onFailure(@NotNull Throwable throwable) { public void onFailure(@NotNull Throwable throwable) {
if (!shutDownRequested) { if (!shutDownRequested && !resultFuture.setException(new PriceRequestException(throwable, baseUrl))) {
if (!resultFuture.setException(new PriceRequestException(throwable, baseUrl))) { // In case the setException returns false we need to cancel the future.
// In case the setException returns false we need to cancel the future. resultFuture.cancel(true);
resultFuture.cancel(true);
}
} }
} }
}, MoreExecutors.directExecutor()); }, MoreExecutors.directExecutor());