use of com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper in project Payara by payara.
the class StopDeploymentGroupCommand method execute.
@Override
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
Logger logger = context.getLogger();
logger.info(Strings.get("stop.dg", deploymentGroup));
// Require that we be a DAS
if (!env.isDas()) {
String msg = Strings.get("cluster.command.notDas");
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
ClusterCommandHelper clusterHelper = new ClusterCommandHelper(domain, runner);
ParameterMap map = null;
if (kill) {
map = new ParameterMap();
map.add("kill", "true");
}
try {
// Run start-instance against each instance in the cluster
String commandName = "stop-instance";
clusterHelper.runCommand(commandName, map, deploymentGroup, context, verbose);
} catch (CommandException e) {
String msg = e.getLocalizedMessage();
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
}
}
use of com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper in project Payara by payara.
the class RestartDeploymentGroupCommand method execute.
@Override
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
Logger logger = context.getLogger();
logger.info(Strings.get("restart.dg", deploymentGroup));
// Require that we be a DAS
if (!env.isDas()) {
String msg = Strings.get("cluster.command.notDas");
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
if (rolling) {
doRolling(context);
} else {
ClusterCommandHelper clusterHelper = new ClusterCommandHelper(domain, runner);
ParameterMap pm = new ParameterMap();
pm.add("delay", delay);
try {
// Run restart-instance against each instance in the cluster
String commandName = "restart-instance";
clusterHelper.runCommand(commandName, pm, deploymentGroup, context, verbose, rolling);
} catch (CommandException e) {
String msg = e.getLocalizedMessage();
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
}
}
}
use of com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper in project Payara by payara.
the class StartDeploymentGroupCommand method execute.
@Override
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
Logger logger = context.getLogger();
logger.info(Strings.get("start.dg", deploymentGroup));
// Require that we be a DAS
if (!env.isDas()) {
String msg = Strings.get("cluster.command.notDas");
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
ClusterCommandHelper clusterHelper = new ClusterCommandHelper(domain, runner);
try {
// Run start-instance against each instance in the cluster
String commandName = "start-instance";
clusterHelper.runCommand(commandName, null, deploymentGroup, context, verbose);
} catch (CommandException e) {
String msg = e.getLocalizedMessage();
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
}
Aggregations