/** Build the final {@code OnlineOptions}. */ public OnlineOptions build() { return new OnlineOptions(data); } }
public static OnlineManagementClient clientInit() throws IOException { OnlineOptions onlineOptions = OnlineOptions .standalone() .hostAndPort(PortProviderUtil.getHost(), 9990) // 9990 is default port for EAP 7 .connectionTimeout(120000) .build(); return ManagementClient.online(onlineOptions); }
private ManagementClient(String mgmtAddress, int mgmtPort) { OnlineManagementClient onlineClient = null; try { onlineClient = org.wildfly.extras.creaper.core.ManagementClient.online(OnlineOptions.domain() .forProfile("clustered") .build() .hostAndPort(mgmtAddress, mgmtPort) .auth(LOGIN, PASSWORD) .build() ); } catch (IOException ex) { throw new IllegalStateException("Error during connecting to server CLI.", ex); } ops = new Operations(onlineClient); }
sslOptions); try { connectAndWaitUntilServerBoots(modelControllerClient, connectionTimeout, bootTimeout); } catch (Exception e) { modelControllerClient.close(); connectAndWaitUntilServerBoots(modelControllerClient, connectionTimeout, bootTimeout); } catch (Exception e) { modelControllerClient.close();
private void connect() throws IOException { this.client = options.createModelControllerClient();
public void reloadServer() throws IOException, TimeoutException, InterruptedException { Administration admin = new Administration(org.wildfly.extras.creaper.core.ManagementClient.online(OnlineOptions.domain() .forHost("master") .build() .hostAndPort(NODE0_ADDRESS, NODE0_PORT) .auth(LOGIN, PASSWORD) .build() )); admin.reload(); }
/** * <p>The {@link org.wildfly.extras.creaper.core.online.OnlineManagementClient} that will be created will wrap * the provided {@link org.jboss.as.controller.client.ModelControllerClient modelControllerClient}.</p> * * <p><b>Note that doing this ties together the lifecycles of the {@code OnlineManagementClient} and * the wrapped {@code ModelControllerClient}!</b> If you close the {@code ModelControllerClient}, the * {@code OnlineManagementClient} becomes unusable. If you close the {@code OnlineManagementClient}, * the wrapped {@code ModelControllerClient} will be closed as well.</p> * * <p>This also means that the new {@code OnlineManagementClient} <b>can't be {@code reconnect}ed</b>, which * is sometimes needed if server reload or restart is performed. Hence, use client wrapping with caution!</p> */ public OnlineOptions wrap(ModelControllerClient modelControllerClient) { if (modelControllerClient == null) { throw new IllegalArgumentException("ModelControllerClient to be wrapped must be set"); } data.wrappedModelControllerClient = modelControllerClient; return new OnlineOptions(data); } }