use of org.glassfish.api.deployment.ApplicationContainer 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);
}
}
Aggregations