presto-main/src/main/java/io/prestosql/memory/RemoteNodeMemory.java/RemoteNodeMemory/asyncRefresh
class RemoteNodeMemory:    public void asyncRefresh(MemoryPoolAssignmentsRequest assignments)
    {
        Duration sinceUpdate = nanosSince(lastUpdateNanos.get());
        if (nanosSince(lastWarningLogged.get()).toMillis() > 1_000 &&
                sinceUpdate.toMillis() > 10_000 &&
                future.get() != null) {
            log.warn("Memory info update request to %s has not returned in %s", memoryInfoUri, sinceUpdate.toString(SECONDS));
            lastWarningLogged.set(System.nanoTime());
        }
        if (sinceUpdate.toMillis() > 1_000 && future.get() == null) {
            Request request = preparePost()
                    .setUri(memoryInfoUri)
                    .setHeader(CONTENT_TYPE, JSON_UTF_8.toString())
                    .setBodyGenerator(jsonBodyGenerator(assignmentsRequestJsonCodec, assignments))
                    .build();
            HttpResponseFuture<JsonResponse<MemoryInfo>> responseFuture = httpClient.executeAsync(request, createFullJsonResponseHandler(memoryInfoCodec));
            future.compareAndSet(null, responseFuture);

            Futures.addCallback(responseFuture, new FutureCallback<JsonResponse<MemoryInfo>>()
            {
                @Override
                public void onSuccess(@Nullable JsonResponse<MemoryInfo> result)
                {
                    lastUpdateNanos.set(System.nanoTime());
                    future.compareAndSet(responseFuture, null);
                    long version = currentAssignmentVersion.get();
                    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: %s", memoryInfoUri, result.getStatusCode(), result.getStatusMessage());
                            return;
                        }
                    }
                    currentAssignmentVersion.compareAndSet(version, assignments.getVersion());
                }

                @Override
                public void onFailure(Throwable t)
                {
                    log.warn("Error fetching memory info from %s: %s", memoryInfoUri, t.getMessage());
                    lastUpdateNanos.set(System.nanoTime());
                    future.compareAndSet(responseFuture, null);
                }
            }, directExecutor());
        }
    }