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) {
resultFuture.set(marketPriceTuple);
}
}
public void onFailure(@NotNull Throwable throwable) {
if (!shutDownRequested) {
if (!resultFuture.setException(new PriceRequestException(throwable, baseUrl))) {
// In case the setException returns false we need to cancel the future.
resultFuture.cancel(true);
}
if (!shutDownRequested && !resultFuture.setException(new PriceRequestException(throwable, baseUrl))) {
// In case the setException returns false we need to cancel the future.
resultFuture.cancel(true);
}
}
}, MoreExecutors.directExecutor());