Source:
<code>public boolean awaitServerSuspend(Set<String> waitForServers, int timeoutInSeconds) { long end = System.currentTimeMillis() + timeoutInSeconds * 1000; Set<BlockingQueueOperationListener<?>> listeners= new HashSet<>(); for (String serverName : waitForServers) { final ManagedServer server = servers.get(serverName); if (server != null) { try { BlockingQueueOperationListener<?> listener = server.suspend(timeoutInSeconds); listeners.add(listener); } catch (IOException ignore) { } } } for (BlockingQueueOperationListener<?> listener : listeners) { try { <START> final TransactionalProtocolClient.PreparedOperation<?> prepared = listener.retrievePreparedOperation(); <END> if (prepared.isFailed()) { continue; } prepared.commit(); prepared.getFinalResult().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); continue; } catch (ExecutionException e) { e.printStackTrace(); } } return System.currentTimeMillis() < end; }</code><technical_language>prevent merging this; meant for consideration in future work. concerned get() line 428 blocking calls timeout. This retrievePreparedOperation call _could_ timeoutInSeconds param set a limit. (There is overloaded retrievePreparedOperation() variant takes a timeout.) need care though, "timeoutInSeconds" user provides is time server is allowed suspend, time suspend _plus_ get a prepared response HC. "plus" is unknown amount of time. So, for limiting blocking time L423 greater of timeoutInSeconds + a fudge factor, general blocking timeout internally for safety OperationContext. (By default 300 seconds). IIRC internal timeout exposed, though. Ideally get() call L428 tie in blocking timeout stuff internally in OperationContext prevent blocking forever. time call L428, server side op is prepared, means server is suspended. delay in a response get() means some problem finishing server side op transmitting/receiving final response. dealing is more of a case of robust inter-process operation handling, "suspend" itself. general OperationContext blocking timeout is more relevant, opposed user provided param timeoutInSeconds. other question is do if timeouts trip. Generally trigger cancellation of remote op fail management request. Domain coordination handlers DomainSlaveHandler DomainRolloutStepHandler a lot of logic lines</technical_language>

Target:
public boolean awaitServerSuspend(Set<String> waitForServers, int timeoutInSeconds) { long end = System.currentTimeMillis() + timeoutInSeconds * 1000; Map<String, BlockingQueueOperationListener<?>> listeners = new HashMap<>(); for (String serverName : waitForServers) { final ManagedServer server = servers.get(serverName); if (server != null) { try { BlockingQueueOperationListener<?> listener = server.suspend(timeoutInSeconds); listeners.put(serverName, listener); } catch (IOException e) { HostControllerLogger.ROOT_LOGGER.suspendExecutionFailed(e, serverName); } } } for (Map.Entry<String, BlockingQueueOperationListener<?>> listenerEntry : listeners.entrySet()) { try { final TransactionalProtocolClient.PreparedOperation<?> prepared = listenerEntry.getValue().retrievePreparedOperation(); if (prepared.isFailed()) { continue; } prepared.commit(); prepared.getFinalResult().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); continue; } catch (ExecutionException e) { HostControllerLogger.ROOT_LOGGER.suspendListenerFailed(e, listenerEntry.getKey()); } } return System.currentTimeMillis() < end; }