Search in sources :

Example 1 with LocalStringsImpl

use of com.sun.enterprise.universal.i18n.LocalStringsImpl in project Payara by payara.

the class RestartServer method doExecute.

/**
 * Restart of the application server :
 *
 * All running services are stopped. LookupManager is flushed.
 *
 * Client code that started us should notice the special return value and restart us.
 */
protected final void doExecute(AdminCommandContext context) {
    try {
        // unfortunately we can't rely on constructors with HK2...
        if (registry == null) {
            throw new NullPointerException(new LocalStringsImpl(getClass()).get("restart.server.internalError", "registry was not set"));
        }
        init(context);
        // get the GlassFish object - we have to wait in case startup is still in progress
        // This is a temporary work-around until HK2 supports waiting for the service to
        // show up in the ServiceLocator.
        GlassFish gfKernel = glassfishProvider.get();
        while (gfKernel == null) {
            Thread.sleep(1000);
            gfKernel = glassfishProvider.get();
        }
        if (!supervised) {
            // do it now while we still have the Logging service running...
            reincarnate();
        }
        prepareToExit();
        // else we just return a special int from System.exit()
        gfKernel.stop();
    } catch (Exception e) {
        context.getLogger().severe(strings.get("restart.server.failure", e));
    } finally {
        stopLock.unlock();
    }
}
Also used : LocalStringsImpl(com.sun.enterprise.universal.i18n.LocalStringsImpl) GlassFish(org.glassfish.embeddable.GlassFish)

Aggregations

LocalStringsImpl (com.sun.enterprise.universal.i18n.LocalStringsImpl)1 GlassFish (org.glassfish.embeddable.GlassFish)1