Search in sources :

Example 1 with ClusterCommandHelper

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);
    }
}
Also used : ClusterCommandHelper(com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper) ParameterMap(org.glassfish.api.admin.ParameterMap) CommandException(org.glassfish.api.admin.CommandException) ActionReport(org.glassfish.api.ActionReport) Logger(java.util.logging.Logger)

Example 2 with ClusterCommandHelper

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);
        }
    }
}
Also used : ClusterCommandHelper(com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper) ParameterMap(org.glassfish.api.admin.ParameterMap) CommandException(org.glassfish.api.admin.CommandException) ActionReport(org.glassfish.api.ActionReport) Logger(java.util.logging.Logger)

Example 3 with ClusterCommandHelper

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;
    }
}
Also used : ClusterCommandHelper(com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper) CommandException(org.glassfish.api.admin.CommandException) ActionReport(org.glassfish.api.ActionReport) Logger(java.util.logging.Logger)

Aggregations

ClusterCommandHelper (com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper)3 Logger (java.util.logging.Logger)3 ActionReport (org.glassfish.api.ActionReport)3 CommandException (org.glassfish.api.admin.CommandException)3 ParameterMap (org.glassfish.api.admin.ParameterMap)2