public void clean(ExtendedDeploymentContext context) { try { getContainerInfo().clean(context); } catch (Exception e) { context.getLogger().log(Level.WARNING, "Exception while cleaning module '" + this + "'" + e, e); } }
public void clean(ExtendedDeploymentContext context) { try { getContainerInfo().clean(context); } catch (Exception e) { context.getLogger().log(Level.WARNING, "Exception while cleaning module '" + this + "'" + e, e); } }
public void unload(ExtendedDeploymentContext context) { Logger logger = context.getLogger(); if (!isLoaded) { logger.fine("Application is already unloaded."); return; } ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(appClassLoader); context.setClassLoader(appClassLoader); super.unload(context); for (ModuleInfo module : reversedModules) { module.unload(getSubContext(module, context)); } isLoaded = false; if (events!=null) { events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_UNLOADED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); context.setClassLoader(null); } }
public void unload(ExtendedDeploymentContext context) { Logger logger = context.getLogger(); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(moduleClassLoader); for (EngineRef engine : _getEngineRefs()) { if (engine.getApplicationContainer()!=null && engine.getApplicationContainer().getClassLoader()!=null) { classLoaders.add(engine.getApplicationContainer().getClassLoader()); try { context.setClassLoader(moduleClassLoader); engine.unload(context); } catch(Throwable e) { logger.log(Level.SEVERE, "Failed to unload from container type : " + engine.getContainerInfo().getSniffer().getModuleType(), e); } } } // add the module classloader to the predestroy list if it's not // already there if (classLoaders != null && moduleClassLoader != null) { classLoaders.add(moduleClassLoader); } if (events!=null) { events.send(new Event<ModuleInfo>(Deployment.MODULE_UNLOADED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); context.setClassLoader(null); } }
public void unload(ExtendedDeploymentContext context) { Logger logger = context.getLogger(); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(moduleClassLoader); for (EngineRef engine : reversedEngines) { if (engine.getApplicationContainer()!=null && engine.getApplicationContainer().getClassLoader()!=null) { classLoaders.add(engine.getApplicationContainer().getClassLoader()); try { context.setClassLoader(moduleClassLoader); engine.unload(context); } catch(Throwable e) { logger.log(Level.SEVERE, "Failed to unload from container type : " + engine.getContainerInfo().getSniffer().getModuleType(), e); } } } // add the module classloader to the predestroy list if it's not // already there if (classLoaders != null && moduleClassLoader != null) { classLoaders.add(moduleClassLoader); } if (events!=null) { events.send(new Event<ModuleInfo>(Deployment.MODULE_UNLOADED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); context.setClassLoader(null); } }
public void unload(ExtendedDeploymentContext context) { Logger logger = context.getLogger(); if (!isLoaded) { logger.fine("Application is already unloaded.");
/** * 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; }
/** * 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; }
public ApplicationInfo unload(ApplicationInfo info, ExtendedDeploymentContext context) { ActionReport report = context.getActionReport(); if (info==null) { report.failure(context.getLogger(), "Application not registered", null); return null; } notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.STOP, context); if (info.isLoaded()) { info.stop(context, context.getLogger()); notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.STOP, context); notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.UNLOAD, context); info.unload(context); notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.UNLOAD, context); } events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_DISABLED, info), false); try { notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.CLEAN, context); info.clean(context); notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.CLEAN, context); } catch(Exception e) { report.failure(context.getLogger(), "Exception while cleaning", e); return info; } return info; }
public ApplicationInfo unload(ApplicationInfo info, ExtendedDeploymentContext context) { ActionReport report = context.getActionReport(); if (info==null) { report.failure(context.getLogger(), "Application not registered", null); return null; } notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.STOP, context); if (info.isLoaded()) { info.stop(context, context.getLogger()); notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.STOP, context); notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.UNLOAD, context); info.unload(context); notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.UNLOAD, context); } events.send(new Event<ApplicationInfo>(Deployment.APPLICATION_DISABLED, info), false); try { notifyLifecycleInterceptorsBefore(ExtendedDeploymentContext.Phase.CLEAN, context); info.clean(context); notifyLifecycleInterceptorsAfter(ExtendedDeploymentContext.Phase.CLEAN, context); } catch(Exception e) { report.failure(context.getLogger(), "Exception while cleaning", e); return info; } return info; }
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception { Logger logger = context.getLogger(); context.setPhase(ExtendedDeploymentContext.Phase.LOAD); DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception { Logger logger = context.getLogger(); context.setPhase(ExtendedDeploymentContext.Phase.LOAD); DeploymentTracing tracing = context.getModuleMetaData(DeploymentTracing.class);
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception { Logger logger = context.getLogger(); if (isLoaded) { logger.fine("Application is already loaded.");
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) throws Exception { Logger logger = context.getLogger(); if (isLoaded) { logger.fine("Application is already loaded.");
public void undeploy(String appName, ExtendedDeploymentContext context) { ActionReport report = context.getActionReport(); 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); }
public void undeploy(String appName, ExtendedDeploymentContext context) { ActionReport report = context.getActionReport(); 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); }