use of org.wildfly.swarm.container.runtime.cdi.FractionProducingExtension in project wildfly-swarm by wildfly-swarm.
the class ServerBootstrapImpl method bootstrap.
@Override
public Server bootstrap() throws Exception {
try (AutoCloseable bootstrap = Performance.time("Bootstrap")) {
Module module = Module.getBootModuleLoader().loadModule("swarm.container");
return ClassLoading.withTCCL(new ExtensionPreventionClassLoaderWrapper(module.getClassLoader()), () -> {
try (AutoCloseable logFractionHandle = Performance.time("Log fractions")) {
logFractions();
}
RuntimeServer outerServer = LogSilencer.silently("org.jboss.weld", "ServiceLoader").execute(() -> {
Weld weld = new Weld(WELD_INSTANCE_ID);
weld.setClassLoader(module.getClassLoader());
ConfigViewProducingExtension configViewProducingExtension = new ConfigViewProducingExtension(this.configView);
DeploymentContext deploymentContext = new DeploymentContextImpl();
ConfigurableManager configurableManager = new ConfigurableManager(this.configView, deploymentContext);
// Add Extension that adds User custom bits into configurator
weld.addExtension(new FractionProducingExtension(explicitlyInstalledFractions, configurableManager));
weld.addExtension(new ConfigurableExtension(configurableManager));
weld.addExtension(new CommandLineArgsExtension(args));
weld.addExtension(configViewProducingExtension);
weld.addExtension(new XMLConfigProducingExtension(this.xmlConfigURL));
weld.addExtension(new InterfaceExtension(this.configView));
weld.addExtension(new OutboundSocketBindingExtension(this.outboundSocketBindings));
weld.addExtension(new SocketBindingExtension(this.socketBindings));
weld.addExtension(new DeploymentScopedExtension(deploymentContext));
weld.addExtension(new ImplicitArchiveExtension());
for (Class<?> each : this.userComponents) {
weld.addBeanClass(each);
}
weld.property("org.jboss.weld.se.shutdownHook", false);
WeldContainer weldContainer = null;
RuntimeServer server = null;
try (AutoCloseable weldRelated = Performance.time("Weld-related")) {
try (AutoCloseable weldInitHandle = Performance.time("Weld initialize")) {
weldContainer = weld.initialize();
}
try (AutoCloseable serverSelectHandle = Performance.time("Server construction")) {
server = weldContainer.select(RuntimeServer.class).get();
}
}
return server;
});
try (AutoCloseable weldInitHandle = Performance.time("Server start")) {
outerServer.start(true);
}
return outerServer;
});
} finally {
SwarmMetricsMessages.MESSAGES.bootPerformance(Performance.dump());
}
}
Aggregations