Search in sources :

Example 1 with FractionProducingExtension

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());
    }
}
Also used : InterfaceExtension(org.wildfly.swarm.container.runtime.cdi.InterfaceExtension) OutboundSocketBindingExtension(org.wildfly.swarm.container.runtime.cdi.OutboundSocketBindingExtension) FractionProducingExtension(org.wildfly.swarm.container.runtime.cdi.FractionProducingExtension) WeldContainer(org.jboss.weld.environment.se.WeldContainer) ConfigViewProducingExtension(org.wildfly.swarm.container.runtime.cdi.ConfigViewProducingExtension) Weld(org.jboss.weld.environment.se.Weld) DeploymentContextImpl(org.wildfly.swarm.container.runtime.cdi.DeploymentContextImpl) DeploymentScopedExtension(org.wildfly.swarm.container.runtime.cdi.DeploymentScopedExtension) DeploymentContext(org.wildfly.swarm.container.runtime.cdi.DeploymentContext) XMLConfigProducingExtension(org.wildfly.swarm.container.runtime.cdi.XMLConfigProducingExtension) ImplicitArchiveExtension(org.wildfly.swarm.container.runtime.cdi.ImplicitArchiveExtension) CommandLineArgsExtension(org.wildfly.swarm.container.runtime.cli.CommandLineArgsExtension) ConfigurableExtension(org.wildfly.swarm.container.runtime.cdi.configurable.ConfigurableExtension) Module(org.jboss.modules.Module) OutboundSocketBindingExtension(org.wildfly.swarm.container.runtime.cdi.OutboundSocketBindingExtension) SocketBindingExtension(org.wildfly.swarm.container.runtime.cdi.SocketBindingExtension)

Aggregations

Module (org.jboss.modules.Module)1 Weld (org.jboss.weld.environment.se.Weld)1 WeldContainer (org.jboss.weld.environment.se.WeldContainer)1 ConfigViewProducingExtension (org.wildfly.swarm.container.runtime.cdi.ConfigViewProducingExtension)1 DeploymentContext (org.wildfly.swarm.container.runtime.cdi.DeploymentContext)1 DeploymentContextImpl (org.wildfly.swarm.container.runtime.cdi.DeploymentContextImpl)1 DeploymentScopedExtension (org.wildfly.swarm.container.runtime.cdi.DeploymentScopedExtension)1 FractionProducingExtension (org.wildfly.swarm.container.runtime.cdi.FractionProducingExtension)1 ImplicitArchiveExtension (org.wildfly.swarm.container.runtime.cdi.ImplicitArchiveExtension)1 InterfaceExtension (org.wildfly.swarm.container.runtime.cdi.InterfaceExtension)1 OutboundSocketBindingExtension (org.wildfly.swarm.container.runtime.cdi.OutboundSocketBindingExtension)1 SocketBindingExtension (org.wildfly.swarm.container.runtime.cdi.SocketBindingExtension)1 XMLConfigProducingExtension (org.wildfly.swarm.container.runtime.cdi.XMLConfigProducingExtension)1 ConfigurableExtension (org.wildfly.swarm.container.runtime.cdi.configurable.ConfigurableExtension)1 CommandLineArgsExtension (org.wildfly.swarm.container.runtime.cli.CommandLineArgsExtension)1