Search in sources :

Example 1 with Deployer

use of org.glassfish.api.deployment.Deployer in project Payara by payara.

the class EngineRef method unload.

/**
 * unloads the module from its container.
 *
 * @param context unloading context
 * @return
 */
public boolean unload(ExtendedDeploymentContext context) {
    ActionReport report = context.getActionReport();
    // then remove the application from the container
    Deployer deployer = ctrInfo.getDeployer();
    try {
        deployer.unload(appCtr, context);
        ctrInfo.unload(context);
    } catch (Exception e) {
        report.failure(context.getLogger(), "Exception while shutting down application container", e);
        return false;
    }
    appCtr = null;
    return true;
}
Also used : ActionReport(org.glassfish.api.ActionReport) Deployer(org.glassfish.api.deployment.Deployer) PropertyVetoException(java.beans.PropertyVetoException)

Example 2 with Deployer

use of org.glassfish.api.deployment.Deployer in project Payara by payara.

the class ModuleInfo method load.

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);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Logger(java.util.logging.Logger) ApplicationContainer(org.glassfish.api.deployment.ApplicationContainer) LinkedList(java.util.LinkedList) PropertyVetoException(java.beans.PropertyVetoException) DeploymentTracing(org.glassfish.internal.deployment.DeploymentTracing) Deployer(org.glassfish.api.deployment.Deployer)

Aggregations

PropertyVetoException (java.beans.PropertyVetoException)2 Deployer (org.glassfish.api.deployment.Deployer)2 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 Logger (java.util.logging.Logger)1 ActionReport (org.glassfish.api.ActionReport)1 ApplicationContainer (org.glassfish.api.deployment.ApplicationContainer)1 DeploymentTracing (org.glassfish.internal.deployment.DeploymentTracing)1