/** returns the underlying value, throwing if there is an error which is not masked (ie {@link #throwsErrorOnAccess()} is set) */ @Override public T get() { if (masksErrorIfPresent()) { return getWithoutError(); } return getWithError(); }
/** * @throws StopFailedRuntimeException If stop failed, after successfully starting replacement */ protected Entity replaceMember(Entity member, @Nullable Location memberLoc, Map<?, ?> extraFlags) { synchronized (mutex) { ReferenceWithError<Optional<Entity>> added = addInSingleLocation(memberLoc, extraFlags); if (!added.getWithoutError().isPresent()) { String msg = String.format("In %s, failed to grow, to replace %s; not removing", this, member); if (added.hasError()) throw new IllegalStateException(msg, added.getError()); throw new IllegalStateException(msg); } try { stopAndRemoveNode(member); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new StopFailedRuntimeException("replaceMember failed to stop and remove old member "+member.getId(), e); } return added.getWithError().get(); } }
public void rebootAndWait(String hostname) { try { if (hostname != null) { getLocation().executePsScript(ImmutableMap.of(WinRmTool.COMPUTER_NAME, hostname), ImmutableList.of("Restart-Computer -Force")); } else { getLocation().executePsScript(ImmutableList.of("Restart-Computer -Force")); } } catch (Exception e) { Throwable interestingCause = findExceptionCausedByWindowsRestart(e); if (interestingCause != null) { LOG.debug("Restarting... exception while closing winrm session from the restart command {}", getEntity(), e); } else { throw e; } } waitForWinRmStatus(false, entity.getConfig(VanillaWindowsProcess.REBOOT_BEGUN_TIMEOUT)); waitForWinRmStatus(true, entity.getConfig(VanillaWindowsProcess.REBOOT_COMPLETED_TIMEOUT)).getWithError(); }
return result.getWithError();