Package org.glassfish.api.event.EventListener

Examples of org.glassfish.api.event.EventListener.Event


        UndeployCommandParameters params = context.getCommandParameters(UndeployCommandParameters.class);

        ApplicationInfo info = appRegistry.get(appName);
        if (info==null) {
            report.failure(context.getLogger(), "Application " + appName + " not registered", null);
            events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context));
            return;

        }

        events.send(new Event(Deployment.UNDEPLOYMENT_START, info));

        // for DAS target, the undeploy should unload the application
        // as well
        if (DeploymentUtils.isDASTarget(params.target)) {
            unload(info, context);
        }

        if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) {
            events.send(new Event(Deployment.UNDEPLOYMENT_SUCCESS, context));
            deploymentLifecycleProbeProvider.applicationUndeployedEvent(appName, getApplicationType(info));
        } else {           
            events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context));           
        }
       
        appRegistry.remove(appName);
    }
View Full Code Here


        UndeployCommandParameters params = context.getCommandParameters(UndeployCommandParameters.class);

        ApplicationInfo info = appRegistry.get(appName);
        if (info==null) {
            report.failure(context.getLogger(), "Application " + appName + " not registered", null);
            events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context));
            return;

        }

        events.send(new Event(Deployment.UNDEPLOYMENT_START, info));

        // for DAS target, the undeploy should unload the application
        // as well
        if (DeploymentUtils.isDASTarget(params.target)) {
            unload(info, context);
        }

        if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) {
            events.send(new Event(Deployment.UNDEPLOYMENT_SUCCESS, context));
            deploymentLifecycleProbeProvider.applicationUndeployedEvent(appName, getApplicationType(info));
        } else {           
            events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context));           
        }
       
        appRegistry.remove(appName);
    }
View Full Code Here

            // In such a case, ignore any subsequent stop operations.
            logger.info("Already stopped, so just returning");
            return;
        }
        env.setStatus(ServerEnvironment.Status.stopping);
        events.send(new Event(EventTypes.PREPARE_SHUTDOWN), false);

        // deactivate the run level services
        proceedTo(InitRunLevel.VAL, new AppServerActivator());

        // first send the shutdown event synchronously
        env.setStatus(ServerEnvironment.Status.stopped);
        events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);

        runLevelController.proceedTo(0);

        logger.info(localStrings.getLocalString("shutdownfinished","Shutdown procedure finished"));
View Full Code Here

                        futures.addAll(((FutureProvider) startup).getFutures());
                    }
                } catch(RuntimeException e) {
                    logger.log(Level.SEVERE, localStrings.getLocalString("startupservicefailure",
                            "Startup service failed to start " + activeDescriptor), e);
                    events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);
                    forceShutdown();
                    return;
                }
                if (logger.isLoggable(level)) {
                    servicesTiming.put(type, (System.currentTimeMillis() - start));
View Full Code Here

            if (runLevelController.getCurrentRunLevel() < StartupRunLevel.VAL - 1 || isShutdown()) {
                return;
            }

            env.setStatus(ServerEnvironment.Status.starting);
            events.send(new Event(EventTypes.SERVER_STARTUP), false);

            // finally let's calculate our starting times
            logger.info(localStrings.getLocalString("startup_end_message",
                    "{0} ({1}) startup time : {2} ({3}ms), startup services({4}ms), total({5}ms)",
                    Version.getVersion(), Version.getBuildVersion(), platform,
                    (platformInitTime - context.getCreationTime()),
                    (System.currentTimeMillis() - platformInitTime),
                    System.currentTimeMillis() - context.getCreationTime()));

            printModuleStatus(systemRegistry, level);

            try {
                // it will only be set when called from AsadminMain and the env. variable AS_DEBUG is set to true
                long realstart = Long.parseLong(System.getProperty("WALL_CLOCK_START"));
                logger.info("TOTAL TIME INCLUDING CLI: "  + (System.currentTimeMillis() - realstart));
            }
            catch(Exception e) {
                // do nothing.
            }

            if (logger.isLoggable(level)) {
                for (Map.Entry<Class, Long> service : servicesTiming.entrySet()) {
                    logger.log(level, "Service : " + service.getKey() + " took " + service.getValue() + " ms");
                }
            }

            for (Future<Result<Thread>> future : futures) {
                try {
                    try {
                        // wait for an eventual status, otherwise ignore
                        if (future.get(timeout, unit).isFailure()) {
                            final Throwable t = future.get().exception();
                            logger.log(Level.SEVERE,
                                    localStrings.getLocalString("startupfatalstartup",
                                            "Shutting down server due to startup exception : "),
                                    t);
                            events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);
                            forceShutdown();
                            return;
                        }
                    } catch(TimeoutException e) {
                        logger.warning(localStrings.getLocalString("startupwaittimeout",
                                "Timed out, ignoring some startup service status"));
                    }
                } catch(Throwable t) {
                    logger.log(Level.SEVERE, t.getMessage(), t);
                }
            }

            env.setStatus(ServerEnvironment.Status.started);
            events.send(new Event(EventTypes.SERVER_READY), false);
            pidWriter.writePidFile();
        }
View Full Code Here

            logger.fine("Already stopped, so just returning");
            return;
        }
        env.setStatus(ServerEnvironment.Status.stopping);
        try {
            events.send(new Event(EventTypes.PREPARE_SHUTDOWN), false);
        } catch (Exception e) {
            logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e);
        }

        // deactivate the run level services
        try {
            proceedTo(InitRunLevel.VAL, new AppServerActivator(null));
        } catch (Exception e) {
            logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e);
        }

        // first send the shutdown event synchronously
        env.setStatus(ServerEnvironment.Status.stopped);
        try {
            events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);
        } catch (Exception e) {
            logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e);
        }

        try {
View Full Code Here

                if (startup instanceof FutureProvider) {
                    futures.addAll(((FutureProvider) startup).getFutures());
                }
            } catch(RuntimeException e) {
                logger.log(Level.SEVERE, KernelLoggerInfo.startupFailure, e);
                events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);
                forceShutdown();
                return;
            }
            if (recordedTimes != null) {
                recordedTimes.put(type, (System.currentTimeMillis() - start));
View Full Code Here

            if (runLevelController.getCurrentRunLevel() < StartupRunLevel.VAL - 1 || isShutdown()) {
                return;
            }

            env.setStatus(ServerEnvironment.Status.starting);
            events.send(new Event(EventTypes.SERVER_STARTUP), false);

            // finally let's calculate our starting times
            long nowTime = System.currentTimeMillis();
            logger.log(Level.INFO, KernelLoggerInfo.startupEndMessage,
                    new Object[] { Version.getVersion(), Version.getBuildVersion(), platform,
                    (platformInitTime - context.getCreationTime()),
                    (nowTime - platformInitTime),
                    nowTime - context.getCreationTime()});

            printModuleStatus(systemRegistry, level);

            String wallClockStart = System.getProperty("WALL_CLOCK_START");
            if (wallClockStart != null) {
                try {
                    // it will only be set when called from AsadminMain and the env. variable AS_DEBUG is set to true
                    long realstart = Long.parseLong(wallClockStart);
                    logger.log(Level.INFO, KernelLoggerInfo.startupTotalTime, (System.currentTimeMillis() - realstart));
                }
                catch(Exception e) {
                    // do nothing.
                }
            }

            for (Future<Result<Thread>> future : futures) {
                try {
                    try {
                        // wait for an eventual status, otherwise ignore
                        if (future.get(timeout, unit).isFailure()) {
                            final Throwable t = future.get().exception();
                            logger.log(Level.SEVERE, KernelLoggerInfo.startupFatalException, t);
                            events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);
                            forceShutdown();
                            return;
                        }
                    } catch(TimeoutException e) {
                        logger.log(Level.WARNING, KernelLoggerInfo.startupWaitTimeout, e);
                    }
                } catch(Throwable t) {
                    logger.log(Level.SEVERE, KernelLoggerInfo.startupException, t);
                }
            }

            env.setStatus(ServerEnvironment.Status.started);
            events.send(new Event(EventTypes.SERVER_READY), false);
            pidWriter.writePidFile();
           
            if (recordedTimes != null) {
                long finish = System.currentTimeMillis();
                logger.log(level, "Startup level done in " +
View Full Code Here

            // In such a case, ignore any subsequent stop operations.
            logger.fine("Already stopped, so just returning");
            return;
        }
        env.setStatus(ServerEnvironment.Status.stopping);
        events.send(new Event(EventTypes.PREPARE_SHUTDOWN), false);

        // deactivate the run level services
        proceedTo(InitRunLevel.VAL, new AppServerActivator());

        // first send the shutdown event synchronously
        env.setStatus(ServerEnvironment.Status.stopped);
        events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);

        runLevelController.proceedTo(0);

        logger.info(KernelLoggerInfo.shutdownFinished);
View Full Code Here

                    if (startup instanceof FutureProvider) {
                        futures.addAll(((FutureProvider) startup).getFutures());
                    }
                } catch(RuntimeException e) {
                    logger.log(Level.SEVERE, KernelLoggerInfo.startupFailure, e);
                    events.send(new Event(EventTypes.SERVER_SHUTDOWN), false);
                    forceShutdown();
                    return;
                }
                if (logger.isLoggable(level)) {
                    servicesTiming.put(type, (System.currentTimeMillis() - start));
View Full Code Here

TOP

Related Classes of org.glassfish.api.event.EventListener.Event

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.