Package org.glassfish.internal.deployment

Examples of org.glassfish.internal.deployment.DeploymentTracing


            if (handler == null) {
                handler = getArchiveHandler(context.getSource(),
                    commandParams.type);
                context.setArchiveHandler(handler);
            }
            DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);

            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.ARCHIVE_HANDLER_OBTAINED);
            }
            if (handler==null) {
                report.setMessage(localStrings.getLocalString("unknownarchivetype","Archive type of {0} was not recognized",context.getSourceDir()));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return null;               
            }
            ClassLoaderHierarchy clh = habitat.getByContract(ClassLoaderHierarchy.class);
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.CLASS_LOADER_HIERARCHY);
            }

            context.createDeploymentClassLoader(clh, handler);
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.CLASS_LOADER_CREATED);
            }

            getDeployableTypes(context);
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.PARSING_DONE);
            }

            final ClassLoader cloader = context.getClassLoader();
            final ClassLoader currentCL = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(cloader);
               
                // containers that are started are not stopped even if the deployment fail, the main reason
                // is that some container do not support to be restarted.
                if (sniffers!=null && logger.isLoggable(Level.FINE)) {
                    for (Sniffer sniffer : sniffers) {
                        logger.fine("Before Sorting" + sniffer.getModuleType());
                    }
                }
                List<EngineInfo> sortedEngineInfos =
                    setupContainerInfos(handler, sniffers, context);
                if (tracing!=null) {
                    tracing.addMark(DeploymentTracing.Mark.CONTAINERS_SETUP_DONE);
                }

                if (logger.isLoggable(Level.FINE)) {
                    for (EngineInfo info : sortedEngineInfos) {
                        logger.fine("After Sorting " + info.getSniffer().getModuleType());
                    }
                }
                if (sortedEngineInfos ==null || sortedEngineInfos.isEmpty()) {
                    report.failure(logger, localStrings.getLocalString("unknowncontainertype","There is no installed container capable of handling this application {0}",context.getSource().getName()));
                    tracker.actOn(logger);
                    return null;
                }


                // create a temporary application info to hold metadata
                // so the metadata could be accessed at classloader
                // construction time through ApplicationInfo
                ApplicationInfo tempAppInfo = new ApplicationInfo(events,
                    context.getSource(), appName);
                for (Object m : context.getModuleMetadata()) {
                    tempAppInfo.addMetaData(m);
                }
                tempAppInfo.setIsJavaEEApp(sortedEngineInfos);
                appRegistry.add(appName, tempAppInfo);

                events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_BEFORE_CLASSLOADER_CREATION, context), false);

                context.createApplicationClassLoader(clh, handler);
                if (tracing!=null) {
                    tracing.addMark(DeploymentTracing.Mark.CLASS_LOADER_CREATED);
                }


                    // this is a first time deployment as opposed as load following an unload event,
                    // we need to create the application info
                    // todo : we should come up with a general Composite API solution
                    ModuleInfo moduleInfo = null;
                    try {
                          moduleInfo = prepareModule(sortedEngineInfos, appName, context, tracker);
                    } catch(Throwable prepareException) {
                        report.failure(logger, "Exception while preparing the app", null);
                        report.setFailureCause(prepareException);
                        logger.log(Level.SEVERE, prepareException.getMessage(), prepareException);
                        tracker.actOn(logger);
                        return null;
                    }

                    // the deployer did not take care of populating the application info, this
                    // is not a composite module.
                    appInfo=context.getModuleMetaData(ApplicationInfo.class);
                    if (appInfo==null) {
                        appInfo = new ApplicationInfo(events, context.getSource(), appName);
                        appInfo.addModule(moduleInfo);

                        for (Object m : context.getModuleMetadata()) {
                            moduleInfo.addMetaData(m);
                            appInfo.addMetaData(m);
                        }
                    } else {
                        for (EngineRef ref : moduleInfo.getEngineRefs()) {
                            appInfo.add(ref);
                        }
                    }

                // remove the temp application info from the registry
                // first, then register the real one
                appRegistry.remove(appName);
                appInfo.setIsJavaEEApp(sortedEngineInfos);
                appRegistry.add(appName, appInfo);

                if (tracing!=null) {
                    tracing.addMark(DeploymentTracing.Mark.PREPARED);
                }
               
                // send the APPLICATION_PREPARED event
                // set the phase and thread context classloader properly
                // before sending the event
View Full Code Here


                sniffers = snifferManager.getSniffers(context);
            }

        }

        DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
       
        if (sniffers.size()==0) {
            report.failure(logger,localStrings.getLocalString("deploy.unknownmoduletpe","Module type not recognized for module {0}", context.getSourceDir()));
            return null;
        }

        snifferManager.validateSniffers(sniffers, context);

        Map<Deployer, EngineInfo> containerInfosByDeployers = new LinkedHashMap<Deployer, EngineInfo>();

        for (Sniffer sniffer : sniffers) {
            if (sniffer.getContainersNames() == null || sniffer.getContainersNames().length == 0) {
                report.failure(logger, "no container associated with application of type : " + sniffer.getModuleType(), null);
                return null;
            }

            Module snifferModule = modulesRegistry.find(sniffer.getClass());
            if (snifferModule == null) {
                report.failure(logger, "cannot find container module from service implementation " + sniffer.getClass(), null);
                return null;
            }
            final String containerName = sniffer.getContainersNames()[0];
            if (tracing!=null) {
                tracing.addContainerMark(DeploymentTracing.ContainerMark.SNIFFER_DONE, containerName );
            }
           

            // start all the containers associated with sniffers.
            EngineInfo engineInfo = containerRegistry.getContainer(containerName);
            if (engineInfo == null) {
                // need to synchronize on the registry to not end up starting the same container from
                // different threads.
                Collection<EngineInfo> containersInfo=null;
                synchronized (containerRegistry) {
                    if (containerRegistry.getContainer(containerName) == null) {
                        if (tracing!=null) {
                            tracing.addContainerMark(
                                DeploymentTracing.ContainerMark.BEFORE_CONTAINER_SETUP, containerName );
                        }

                        containersInfo = setupContainer(sniffer, snifferModule, logger, context);
                        if (tracing!=null) {
                            tracing.addContainerMark(
                                DeploymentTracing.ContainerMark.AFTER_CONTAINER_SETUP, containerName );
                        }

                        if (containersInfo == null || containersInfo.size() == 0) {
                            String msg = "Cannot start container(s) associated to application of type : " + sniffer.getModuleType();
                            report.failure(logger, msg, null);
                            throw new Exception(msg);
                        }
                    }
                }

                // now start all containers, by now, they should be all setup...
                if (containersInfo != null && !startContainers(containersInfo, logger, context)) {
                    final String msg = "Aborting, Failed to start container " + containerName;
                    report.failure(logger, msg, null);
                    throw new Exception(msg);
                }
            }
            engineInfo = containerRegistry.getContainer(sniffer.getContainersNames()[0]);
            if (tracing!=null) {
                tracing.addContainerMark(
                    DeploymentTracing.ContainerMark.GOT_CONTAINER, containerName );
            }

            if (engineInfo ==null) {
                final String msg = "Aborting, Failed to start container " + containerName;
                report.failure(logger, msg, null);
                throw new Exception(msg);
            }
             Deployer deployer = getDeployer(engineInfo);
             if (deployer==null) {
                if (!startContainers(Collections.singleton(engineInfo), logger, context)) {
                    final String msg = "Aborting, Failed to start container " + containerName;
                    report.failure(logger, msg, null);
                    throw new Exception(msg);
                }
                deployer = getDeployer(engineInfo);

                if (deployer == null) {
                     report.failure(logger, "Got a null deployer out of the " + engineInfo.getContainer().getClass() + " container, is it annotated with @Service ?");
                     return null;
                }
             }
            if (tracing!=null) {
                tracing.addContainerMark(
                    DeploymentTracing.ContainerMark.GOT_DEPLOYER, containerName );
            }

            containerInfosByDeployers.put(deployer, engineInfo);
        }
View Full Code Here

        ProgressTracker tracker) throws Exception {

        ActionReport report = context.getActionReport();
        List<EngineRef> addedEngines = new ArrayList<EngineRef>();

        DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);

        if (tracing!=null) {
            tracing.addModuleMark(DeploymentTracing.ModuleMark.PREPARE,
                        moduleName);
        }

        for (EngineInfo engineInfo : sortedEngineInfos) {

            // get the deployer
            Deployer deployer = engineInfo.getDeployer();

            try {
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.PREPARE,
                                engineInfo.getSniffer().getModuleType() );
                }
                deployer.prepare(context);
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.PREPARED,
                                engineInfo.getSniffer().getModuleType() );
                }


                // construct an incomplete EngineRef which will be later
                // filled in at loading time
                EngineRef engineRef = new EngineRef(engineInfo, null);
                addedEngines.add(engineRef);
                tracker.add("prepared", EngineRef.class, engineRef);

                tracker.add(Deployer.class, deployer);
            } catch(Exception e) {
                report.failure(logger, "Exception while invoking " + deployer.getClass() + " prepare method", e);
                throw e;
            }
        }
        if (tracing!=null) {
            tracing.addModuleMark(DeploymentTracing.ModuleMark.PREPARE_EVENTS, moduleName);
        }
       
        if (events!=null) {
            events.send(new Event<DeploymentContext>(Deployment.MODULE_PREPARED, context), false);
        }
        if (tracing!=null) {
            tracing.addModuleMark(DeploymentTracing.ModuleMark.PREPARED,moduleName);
        }

        // I need to create the application info here from the context, or something like this.
        // and return the application info from this method for automatic registration in the caller.
View Full Code Here

                report.setMessage(localStrings.getLocalString("unknownarchivetype","Archive type of {0} was not recognized",context.getSourceDir()));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return null;
            }

            DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);

            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.ARCHIVE_HANDLER_OBTAINED);
            }

            getDeployableTypes(context);
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.PARSING_DONE);
            }

            // containers that are started are not stopped even if
            // the deployment fail, the main reason
            // is that some container do not support to be restarted.
            if (sniffers!=null && logger.isLoggable(Level.FINE)) {
                for (Sniffer sniffer : sniffers) {
                    logger.fine("Before Sorting" + sniffer.getModuleType());
                }
            }
            sniffers = getSniffers(handler, sniffers, context);

            ClassLoaderHierarchy clh = habitat.getService(ClassLoaderHierarchy.class);
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.CLASS_LOADER_HIERARCHY);
            }

            context.createDeploymentClassLoader(clh, handler);
            events.send(new Event<DeploymentContext>(Deployment.AFTER_DEPLOYMENT_CLASSLOADER_CREATION, context), false);
           
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.CLASS_LOADER_CREATED);
            }

            final ClassLoader cloader = context.getClassLoader();
            final ClassLoader currentCL = Thread.currentThread().getContextClassLoader();
            try {
                Thread.currentThread().setContextClassLoader(cloader);
               
                List<EngineInfo> sortedEngineInfos =
                    setupContainerInfos(handler, sniffers, context);
                if (tracing!=null) {
                    tracing.addMark(DeploymentTracing.Mark.CONTAINERS_SETUP_DONE);
                }

                if (logger.isLoggable(Level.FINE)) {
                    for (EngineInfo info : sortedEngineInfos) {
                        logger.fine("After Sorting " + info.getSniffer().getModuleType());
                    }
                }
                if (sortedEngineInfos ==null || sortedEngineInfos.isEmpty()) {
                    report.failure(logger, localStrings.getLocalString("unknowncontainertype","There is no installed container capable of handling this application {0}",context.getSource().getName()));
                    tracker.actOn(logger);
                    return null;
                }


                // create a temporary application info to hold metadata
                // so the metadata could be accessed at classloader
                // construction time through ApplicationInfo
                ApplicationInfo tempAppInfo = new ApplicationInfo(events,
                    context.getSource(), appName);
                for (Object m : context.getModuleMetadata()) {
                    tempAppInfo.addMetaData(m);
                }
                tempAppInfo.setIsJavaEEApp(sortedEngineInfos);
                // set the flag on the archive to indicate whether it's
                // a JavaEE archive or not
                context.getSource().setExtraData(Boolean.class, tempAppInfo.isJavaEEApp());
                appRegistry.add(appName, tempAppInfo);

                try {
                    notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.PREPARE, context);
                } catch(Throwable interceptorException) {
                    report.failure(logger, "Exception while invoking the lifecycle interceptor", null);
                    report.setFailureCause(interceptorException);
                    logger.log(Level.SEVERE, KernelLoggerInfo.lifecycleException, interceptorException);
                    tracker.actOn(logger);
                    return null;
                }

                events.send(new Event<DeploymentContext>(Deployment.DEPLOYMENT_BEFORE_CLASSLOADER_CREATION, context), false);

                context.createApplicationClassLoader(clh, handler);
               
                events.send(new Event<DeploymentContext>(Deployment.AFTER_APPLICATION_CLASSLOADER_CREATION, context), false);
               
                if (tracing!=null) {
                    tracing.addMark(DeploymentTracing.Mark.CLASS_LOADER_CREATED);
                }

                    // this is a first time deployment as opposed as load following an unload event,
                    // we need to create the application info
                    // todo : we should come up with a general Composite API solution
                    ModuleInfo moduleInfo = null;
                    try {
                          moduleInfo = prepareModule(sortedEngineInfos, appName, context, tracker);
                          // Now that the prepare phase is done, any artifacts
                          // should be available.  Go ahead and create the
                          // downloadable client JAR.  We want to do this now, or
                          // at least before the load and start phases, because
                          // (for example) the app client deployer start phase
                          // needs to find all generated files when it runs.
                          final ClientJarWriter cjw = new ClientJarWriter(context);
                          cjw.run();
                    } catch(Throwable prepareException) {
                        prepareException.printStackTrace();
                        report.failure(logger, "Exception while preparing the app", null);
                        report.setFailureCause(prepareException);
                        logger.log(Level.SEVERE, KernelLoggerInfo.lifecycleException, prepareException);
                        tracker.actOn(logger);
                        return null;
                    }

                    // the deployer did not take care of populating the application info, this
                    // is not a composite module.
                    appInfo=context.getModuleMetaData(ApplicationInfo.class);
                    if (appInfo==null) {
                        appInfo = new ApplicationInfo(events, context.getSource(), appName);
                        appInfo.addModule(moduleInfo);

                        for (Object m : context.getModuleMetadata()) {
                            moduleInfo.addMetaData(m);
                            appInfo.addMetaData(m);
                        }
                    } else {
                        for (EngineRef ref : moduleInfo.getEngineRefs()) {
                            appInfo.add(ref);
                        }
                    }

                // remove the temp application info from the registry
                // first, then register the real one
                appRegistry.remove(appName);
                appInfo.setIsJavaEEApp(sortedEngineInfos);
                appRegistry.add(appName, appInfo);

                notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.PREPARE, context);

                if (tracing!=null) {
                    tracing.addMark(DeploymentTracing.Mark.PREPARED);
                }
               
                // send the APPLICATION_PREPARED event
                // set the phase and thread context classloader properly
                // before sending the event
View Full Code Here

            Collection<? extends Sniffer> sniffers, DeploymentContext context)
             throws Exception {

        final ActionReport report = context.getActionReport();

        DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);

        Map<Deployer, EngineInfo> containerInfosByDeployers = new LinkedHashMap<Deployer, EngineInfo>();

        for (Sniffer sniffer : sniffers) {
            if (sniffer.getContainersNames() == null || sniffer.getContainersNames().length == 0) {
                report.failure(logger, "no container associated with application of type : " + sniffer.getModuleType(), null);
                return null;
            }

            final String containerName = sniffer.getContainersNames()[0];
            if (tracing!=null) {
                tracing.addContainerMark(DeploymentTracing.ContainerMark.SNIFFER_DONE, containerName );
            }
           

            // start all the containers associated with sniffers.
            EngineInfo engineInfo = containerRegistry.getContainer(containerName);
            if (engineInfo == null) {
                // need to synchronize on the registry to not end up starting the same container from
                // different threads.
                Collection<EngineInfo> containersInfo=null;
                synchronized (containerRegistry) {
                    if (containerRegistry.getContainer(containerName) == null) {
                        if (tracing!=null) {
                            tracing.addContainerMark(
                                DeploymentTracing.ContainerMark.BEFORE_CONTAINER_SETUP, containerName );
                        }

                        containersInfo = setupContainer(sniffer, logger, context);
                        if (tracing!=null) {
                            tracing.addContainerMark(
                                DeploymentTracing.ContainerMark.AFTER_CONTAINER_SETUP, containerName );
                        }

                        if (containersInfo == null || containersInfo.size() == 0) {
                            String msg = "Cannot start container(s) associated to application of type : " + sniffer.getModuleType();
                            report.failure(logger, msg, null);
                            throw new Exception(msg);
                        }
                    }
                }

                // now start all containers, by now, they should be all setup...
                if (containersInfo != null && !startContainers(containersInfo, logger, context)) {
                    final String msg = "Aborting, Failed to start container " + containerName;
                    report.failure(logger, msg, null);
                    throw new Exception(msg);
                }
            }
            engineInfo = containerRegistry.getContainer(sniffer.getContainersNames()[0]);
            if (tracing!=null) {
                tracing.addContainerMark(
                    DeploymentTracing.ContainerMark.GOT_CONTAINER, containerName );
            }

            if (engineInfo ==null) {
                final String msg = "Aborting, Failed to start container " + containerName;
                report.failure(logger, msg, null);
                throw new Exception(msg);
            }
             Deployer deployer = getDeployer(engineInfo);
             if (deployer==null) {
                if (!startContainers(Collections.singleton(engineInfo), logger, context)) {
                    final String msg = "Aborting, Failed to start container " + containerName;
                    report.failure(logger, msg, null);
                    throw new Exception(msg);
                }
                deployer = getDeployer(engineInfo);

                if (deployer == null) {
                     report.failure(logger, "Got a null deployer out of the " + engineInfo.getContainer().getClass() + " container, is it annotated with @Service ?");
                     return null;
                }
             }
            if (tracing!=null) {
                tracing.addContainerMark(
                    DeploymentTracing.ContainerMark.GOT_DEPLOYER, containerName );
            }

            containerInfosByDeployers.put(deployer, engineInfo);
        }
View Full Code Here

        ProgressTracker tracker) throws Exception {

        ActionReport report = context.getActionReport();
        List<EngineRef> addedEngines = new ArrayList<EngineRef>();

        DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);

        if (tracing!=null) {
            tracing.addModuleMark(DeploymentTracing.ModuleMark.PREPARE,
                        moduleName);
        }

        for (EngineInfo engineInfo : sortedEngineInfos) {

            // get the deployer
            Deployer deployer = engineInfo.getDeployer();

            try {
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.PREPARE,
                                engineInfo.getSniffer().getModuleType() );
                }
                deployer.prepare(context);
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.PREPARED,
                                engineInfo.getSniffer().getModuleType() );
                }


                // construct an incomplete EngineRef which will be later
                // filled in at loading time
                EngineRef engineRef = new EngineRef(engineInfo, null);
                addedEngines.add(engineRef);
                tracker.add("prepared", EngineRef.class, engineRef);

                tracker.add(Deployer.class, deployer);
            } catch(Exception e) {
                report.failure(logger, "Exception while invoking " + deployer.getClass() + " prepare method", e);
                throw e;
            }
        }
        if (tracing!=null) {
            tracing.addModuleMark(DeploymentTracing.ModuleMark.PREPARE_EVENTS, moduleName);
        }
       
        if (events!=null) {
            events.send(new Event<DeploymentContext>(Deployment.MODULE_PREPARED, context), false);
        }
        if (tracing!=null) {
            tracing.addModuleMark(DeploymentTracing.ModuleMark.PREPARED,moduleName);
        }

        // I need to create the application info here from the context, or something like this.
        // and return the application info from this method for automatic registration in the caller.
View Full Code Here

                archive.exists("META-INF/ejb-jar.xml") ||
                archive.exists("META-INF/application-client.xml") ||
                archive.exists("META-INF/ra.xml")) {
                String archiveType = context.getArchiveHandler().getArchiveType() ;
                application = applicationFactory.createApplicationFromStandardDD(archive, archiveType);
                DeploymentTracing tracing = null;
                tracing = context.getModuleMetaData(DeploymentTracing.class);
                if (tracing != null) {
                    tracing.addMark(DeploymentTracing.Mark.DOL_LOADED);
                }
                ApplicationHolder holder = new ApplicationHolder(application);
                context.addModuleMetaData(holder);

                return application.getAppName();
View Full Code Here

    }

    public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception {
        Logger logger = context.getLogger();
        context.setPhase(ExtendedDeploymentContext.Phase.LOAD);
        DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
        if (tracing!=null) {
            tracing.addMark(DeploymentTracing.Mark.LOAD);
        }

        moduleClassLoader = context.getClassLoader();

        Set<EngineRef> filteredEngines = new LinkedHashSet<EngineRef>();
        LinkedList<EngineRef> filteredReversedEngines = new LinkedList<EngineRef>();

        ClassLoader currentClassLoader  = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(context.getClassLoader());
            for (EngineRef engine : _getEngineRefs()) {
   
                final EngineInfo engineInfo = engine.getContainerInfo();

                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.LOAD,
                        engineInfo.getSniffer().getModuleType());
                }
               
                // get the container.
                Deployer deployer = engineInfo.getDeployer();

                try {
                   ApplicationContainer appCtr = deployer.load(engineInfo.getContainer(), context);
                   if (appCtr==null) {
                       String msg = "Cannot load application in " + engineInfo.getContainer().getName() + " container";
                       logger.fine(msg);
                       continue;
                   }
                   engine.load(context, tracker);
                   engine.setApplicationContainer(appCtr);
                   filteredEngines.add(engine);
                   filteredReversedEngines.addFirst(engine);
                } catch(Exception e) {
                    logger.log(Level.SEVERE, "Exception while invoking " + deployer.getClass() + " load method", e);
                    throw e;
                }
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.LOADED,
                        engineInfo.getSniffer().getModuleType());
                }

            }
            engines = filteredEngines;
            reversedEngines = filteredReversedEngines;
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.LOAD_EVENTS);
            }

            if (events!=null) {
                events.send(new Event<ModuleInfo>(Deployment.MODULE_LOADED, this), false);
            }
            if (tracing!=null) {
                tracing.addMark(DeploymentTracing.Mark.LOADED);
            }
        } finally {
            Thread.currentThread().setContextClassLoader(currentClassLoader);
        }
View Full Code Here

            // registers all deployed items.
            for (EngineRef engine : _getEngineRefs()) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("starting " + engine.getContainerInfo().getSniffer().getModuleType());
                }
                DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.START,
                        engine.getContainerInfo().getSniffer().getModuleType());
                }

                try {
                    if (!engine.start( context, tracker)) {
                        logger.log(Level.SEVERE, "Module not started " +  engine.getApplicationContainer().toString());
                        throw new Exception( "Module not started " +  engine.getApplicationContainer().toString());
                    }
                } catch(Exception e) {
                    logger.log(Level.SEVERE, "Exception while invoking " + engine.getApplicationContainer().getClass() + " start method", e);
                    throw e;
                }
                if (tracing!=null) {
                    tracing.addContainerMark(DeploymentTracing.ContainerMark.STARTED,
                        engine.getContainerInfo().getSniffer().getModuleType());
                }
            }
            started=true;
            if (events!=null) {
View Full Code Here

            logger.fine("Application is already loaded.");
            return;
        }

        context.setPhase(ExtendedDeploymentContext.Phase.LOAD);
        DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
        if (tracing!=null) {
            tracing.addMark(
                DeploymentTracing.Mark.LOAD);
        }


        super.load(context, tracker);

        appClassLoader = context.getClassLoader();

        for (ModuleInfo module : modules) {
            if (tracing!=null) {
                tracing.addModuleMark(DeploymentTracing.ModuleMark.LOAD, module.getName());
            }
            module.load(getSubContext(module,context), tracker);
            if (tracing!=null) {
                tracing.addModuleMark(DeploymentTracing.ModuleMark.LOADED, module.getName());
            }
        }
       
        populateApplicationServiceLocator();

        isLoaded = true;

        if (tracing!=null) {
            tracing.addMark(DeploymentTracing.Mark.LOAD_EVENTS);
        }

        if (events!=null) {
            events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_LOADED, this), false);
        }
        if (tracing!=null) {
            tracing.addMark(DeploymentTracing.Mark.LOADED);
        }
       
    }
View Full Code Here

TOP

Related Classes of org.glassfish.internal.deployment.DeploymentTracing

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.