void awaitSend() { uncheckedGet(sendFuture); }
/** * Expect a command to be invoked remotely and send replies using the {@link BlockedRequest} methods. */ public <T extends ReplicableCommand> BlockedRequest expectCommand(Class<T> expectedCommandClass) { return uncheckedGet(expectCommandAsync(expectedCommandClass)); }
/** * Wait for a response from {@code sender}, but keep the request blocked. */ public BlockedResponse expectResponse(Address sender, Consumer<Response> checker) { BlockedResponse br = uncheckedGet(expectResponseAsync(sender)); checker.accept(br.response); return br; }
/** * Wait for all the responses. */ public BlockedResponseMap expectAllResponses() { return uncheckedGet(expectAllResponsesAsync()); }
/** * Wait for all the responses. */ public BlockedResponseMap expectAllResponses(BiConsumer<Address, Response> checker) { BlockedResponseMap blockedResponseMap = uncheckedGet(expectAllResponsesAsync()); blockedResponseMap.responseMap.forEach(checker); return blockedResponseMap; }
/** * Wait for a response from {@code sender}, but keep the request blocked. */ public BlockedResponse expectResponse(Address sender) { return uncheckedGet(expectResponseAsync(sender)); }
/** * Expect a command to be invoked remotely and send replies using the {@link BlockedRequest} methods. */ public <T extends ReplicableCommand> BlockedRequest expectCommand(Class<T> expectedCommandClass, Consumer<T> checker) { BlockedRequest blockedRequest = uncheckedGet(expectCommandAsync(expectedCommandClass)); T command = expectedCommandClass.cast(blockedRequest.request.getCommand()); checker.accept(command); return blockedRequest; }
private void queueFinish() { log.tracef("Queueing finish for command %s", command); Map<Address, Response> responseMap = new LinkedHashMap<>(); for (Map.Entry<Address, CompletableFuture<Response>> entry : responseFutures.entrySet()) { Address sender = entry.getKey(); CompletableFuture<Response> responseFuture = entry.getValue(); // Don't wait for all responses in case this is a staggered request if (responseFuture.isDone()) { responseMap.put(sender, uncheckedGet(responseFuture)); } else { responseFuture.complete(null); } } boolean completedNow = finishFuture.complete(responseMap); if (!completedNow) { fail(new IllegalStateException("Finish queued more than once")); } }