Skip to content

Commit

Permalink
Remove unnecessary null-check
Browse files Browse the repository at this point in the history
  • Loading branch information
losipiuk committed Oct 3, 2024
1 parent 23b1e77 commit 82ed10a
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.airlift.log.Logger;
import io.airlift.units.Duration;
import io.trino.metadata.InternalNode;
import jakarta.annotation.Nullable;

import java.net.URI;
import java.util.Optional;
Expand Down Expand Up @@ -95,17 +94,15 @@ public void asyncRefresh()
Futures.addCallback(responseFuture, new FutureCallback<>()
{
@Override
public void onSuccess(@Nullable JsonResponse<MemoryInfo> result)
public void onSuccess(JsonResponse<MemoryInfo> result)
{
lastUpdateNanos.set(System.nanoTime());
future.compareAndSet(responseFuture, null);
if (result != null) {
if (result.hasValue()) {
memoryInfo.set(Optional.ofNullable(result.getValue()));
}
if (result.getStatusCode() != OK.code()) {
log.warn("Error fetching memory info from %s returned status %d", memoryInfoUri, result.getStatusCode());
}
if (result.hasValue()) {
memoryInfo.set(Optional.ofNullable(result.getValue()));
}
if (result.getStatusCode() != OK.code()) {
log.warn("Error fetching memory info from %s returned status %d", memoryInfoUri, result.getStatusCode());
}
}

Expand Down

0 comments on commit 82ed10a

Please sign in to comment.