public boolean restartIfRequired() throws IOException, InterruptedException, TimeoutException { if (isRestartOperationRequired(CommonRestartOperation.RESTART)) { restart(); return true; } return false; }
public void reload() throws IOException, InterruptedException, TimeoutException { performRestartOperation(CommonRestartOperation.RELOAD); }
public boolean reloadIfRequired() throws IOException, InterruptedException, TimeoutException { if (isRestartOperationRequired(CommonRestartOperation.RELOAD)) { reload(); return true; } return false; }
/** * Performs the reload from original configuration. */ // in managed domain, this would apply to the default host public void perform() throws InterruptedException, TimeoutException, IOException { checkReloadToOriginalMakesSense(client, null); new StandaloneAdministrationOperations(client, timeoutInSeconds) .performRestartOperation(new ReloadToOriginalRestartOperation()); }
public boolean isReloadRequired() throws IOException { return isRestartOperationRequired(CommonRestartOperation.RELOAD); }
@Override public void waitUntilRunning() throws InterruptedException, TimeoutException, IOException { waitUntilServerIsRunning(true); }
private void waitUntilServerIsRunning(boolean reconnect) throws IOException, InterruptedException, TimeoutException { Thread.sleep(500); // this value is taken from implementation of CLI "reload" if (reconnect) { client.reconnect(timeoutInSeconds); } long endTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(timeoutInSeconds); while (System.currentTimeMillis() < endTime) { try { if (isServerRunning()) { break; } } catch (Throwable ignored) { // server is probably down, will retry } Thread.sleep(200); // this value is completely arbitrary } boolean running = false; try { running = isServerRunning(); } catch (Throwable ignored) { // server probably down } if (!running) { throw new TimeoutException("Waiting for server timed out"); } }
public Administration(OnlineManagementClient client, int timeoutInSeconds) { this.client = client; if (client.options().isDomain) { this.ops = new DomainAdministrationOperations(client, timeoutInSeconds); } else { this.ops = new StandaloneAdministrationOperations(client, timeoutInSeconds); } }
/** * Reload the server to a snapshot. In managed domain, reloads the default host to a domain.xml snapshot. */ public void perform() throws InterruptedException, TimeoutException, IOException { if (client.options().isStandalone) { new StandaloneAdministrationOperations(client, timeoutInSeconds) .performRestartOperation(new ReloadToStandaloneSnapshotRestartOperation(snapshot)); } else { perform(client.options().defaultHost); } }
@Override public boolean isRestartRequired() throws IOException { return isRestartOperationRequired(CommonRestartOperation.RESTART); }
void performRestartOperation(RestartOperation restartOperation) throws IOException, InterruptedException, TimeoutException { boolean needsToReconnect = false; try { restartOperation.perform(ops, Address.root()); } catch (Throwable e) { // server went down before we received the response, this can happen needsToReconnect = true; } waitUntilServerIsRunning(needsToReconnect); }
public void restart() throws IOException, InterruptedException, TimeoutException { performRestartOperation(CommonRestartOperation.RESTART); }