Search in sources :

Example 1 with InternalSystemAdministrator

use of org.glassfish.internal.api.InternalSystemAdministrator in project Payara by payara.

the class AppServerStartup method shutdown.

// TODO(Sahoo): Revisit this method after discussing with Jerome.
private void shutdown() {
    CommandRunner runner = commandRunnerProvider.get();
    if (runner != null) {
        final ParameterMap params = new ParameterMap();
        // By default we don't want to shutdown forcefully, as that will cause the VM to exit and that's not
        // a very good behavior for a code known to be embedded in other processes.
        final boolean noForcedShutdown = Boolean.parseBoolean(context.getArguments().getProperty(com.sun.enterprise.glassfish.bootstrap.Constants.NO_FORCED_SHUTDOWN, "true"));
        if (noForcedShutdown) {
            params.set("force", "false");
        }
        final InternalSystemAdministrator kernelIdentity = locator.getService(InternalSystemAdministrator.class);
        if (env.isDas()) {
            runner.getCommandInvocation("stop-domain", new DoNothingActionReporter(), kernelIdentity.getSubject()).parameters(params).execute();
        } else {
            runner.getCommandInvocation("_stop-instance", new DoNothingActionReporter(), kernelIdentity.getSubject()).parameters(params).execute();
        }
    }
}
Also used : ParameterMap(org.glassfish.api.admin.ParameterMap) CommandRunner(org.glassfish.api.admin.CommandRunner) InternalSystemAdministrator(org.glassfish.internal.api.InternalSystemAdministrator) DoNothingActionReporter(com.sun.enterprise.v3.common.DoNothingActionReporter)

Aggregations

DoNothingActionReporter (com.sun.enterprise.v3.common.DoNothingActionReporter)1 CommandRunner (org.glassfish.api.admin.CommandRunner)1 ParameterMap (org.glassfish.api.admin.ParameterMap)1 InternalSystemAdministrator (org.glassfish.internal.api.InternalSystemAdministrator)1