public void startCluster(List<Integer> nodeIds) { if (log.isDebugEnabled()) { log.debug("Starting embedded cluster for nodes " + collectionToString(nodeIds)); } else { log.info("Starting embedded cluster"); } long start = System.currentTimeMillis(); File basedir = new File(deploymentOptions.getClusterDir()); for (Integer nodeId : nodeIds) { File nodeDir = new File(basedir, "node" + nodeId); ProcessExecutionResults results = startNode(nodeDir); if (results.getError() != null) { log.warn("An unexpected error occurred while starting the node at " + nodeDir, results.getError()); } else { nodeProcessMap.put(nodeId, results.getProcess()); } } long end = System.currentTimeMillis(); log.info("Started embedded cluster in " + (end - start) + " ms"); }
private String startServer(ASConnection connection, ServerControl control, BundleManagerProvider bmp, BundleResourceDeployment resourceDeployment) { audit(bmp, resourceDeployment, "Start", "Start", null, "Starting the server back up."); ProcessExecutionResults results = control.lifecycle().startServer(); switch (handleExecutionResults(results, bmp, resourceDeployment, false)) { case EXECUTION_ERROR: return "Error trying to start the server. " + results.getError().getMessage(); case ERROR: return "Starting the server failed with error code " + results.getExitCode() + " and output: " + results.getCapturedOutput(); // ignore timeout, because starting the server actually would always be detected as doing it, because the start // script never stops... } try { waitForServerToStart(connection); } catch (InterruptedException e) { String message = "Interrupted while waiting for the server to start up after applying the patch"; Thread.currentThread().interrupt(); return message; } return null; }
Throwable error = results.getError(); Integer exitCode = results.getExitCode();
case EXECUTION_ERROR: return fullErrorMessage("Error trying to run patch rollback: " + results.getError().getMessage(), pids, i - 1, "rolled back"); case TIMEOUT: return fullErrorMessage("Patch rollback timed out. Captured output: " +
private ExecutionResult handleExecutionResults(ProcessExecutionResults results, BundleManagerProvider bmp, BundleResourceDeployment resourceDeployment, boolean doAudit) { ExecutionResult ret = ExecutionResult.OK; if (results.getError() != null) { ret = ExecutionResult.EXECUTION_ERROR; } else if (results.getExitCode() == null) { ret = ExecutionResult.TIMEOUT; } else if (results.getExitCode() != 0) { ret = ExecutionResult.ERROR; } if (doAudit) { audit(bmp, resourceDeployment, "Output", ret == ExecutionResult.OK ? "Standard" : "Error", ret.status(), results.getCapturedOutput()); } return ret; }
Throwable error = results.getError(); Integer exitCode = results.getExitCode(); AvailabilityType avail;
Throwable error = results.getError(); if (error != null) { return BundleHandoverResponse.failure(EXECUTION, error.getMessage(), error);
private Result<Boolean> stopIfNeeded(ASConnection connection, ServerControl control, Configuration bundleDeploymentConfiguration, BundleManagerProvider bmp, BundleResourceDeployment resourceDeployment) { boolean doRestart = Boolean.valueOf(bundleDeploymentConfiguration.getSimpleValue("restart", "true")); if (doRestart && isServerUp(connection)) { audit(bmp, resourceDeployment, "Stop", "Stop", null, "The server is running. Stopping it before any operation on patches."); ProcessExecutionResults results = control.lifecycle().shutdownServer(); switch (handleExecutionResults(results, bmp, resourceDeployment, true)) { case EXECUTION_ERROR: return new Result<Boolean>(false, "Error trying to shutdown the server: " + results.getError().getMessage()); case TIMEOUT: return new Result<Boolean>(false, "Stopping the server timed out. Captured output: " + results.getCapturedOutput()); case ERROR: return new Result<Boolean>(false, "Stopping the server failed with error code " + results.getExitCode() + " and output: " + results.getCapturedOutput()); } return new Result<Boolean>(true, null); } return new Result<Boolean>(false, null); }
private Result<String> getPatchHistoryJSON(ServerControl control, String operation) { ProcessExecutionResults results = control.cli().disconnected(true).executeCliCommand("patch history"); switch (handleExecutionResults(results, null, null, false)) { case EXECUTION_ERROR: return new Result<String>(null, "Failed to determine the patch history while doing a " + operation + ": " + results.getError().getMessage()); case TIMEOUT: return new Result<String>(null, "Timed out while determining patch history for a " + operation + ". Output was: " + results.getCapturedOutput()); case ERROR: return new Result<String>(null, "Failed to determine the patch history for a " + operation + ". Returned error code was: " + results.getExitCode() + "\nOutput was: " + results.getCapturedOutput()); } return new Result<String>(results.getCapturedOutput(), null); }
case EXECUTION_ERROR: result .setErrorMessage("Error while trying to execute patch command: " + results.getError().getMessage()); return result; case TIMEOUT:
return Result.error("Failed to check availability of patch command using the 'help --commands' command. The error was: " + results.getError().getMessage()); case ERROR: return