Search in sources :

Example 1 with ConcurrentContext

use of org.jboss.as.ee.concurrent.ConcurrentContext in project wildfly by wildfly.

the class EEConcurrentContextProcessor method processModuleDescription.

private void processModuleDescription(final EEModuleDescription moduleDescription, DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext) {
    final ConcurrentContext concurrentContext = moduleDescription.getConcurrentContext();
    // setup context
    setupConcurrentContext(concurrentContext, moduleDescription.getApplicationName(), moduleDescription.getModuleName(), null, deploymentUnit.getAttachment(MODULE).getClassLoader(), moduleDescription.getNamespaceContextSelector(), deploymentUnit, phaseContext.getServiceTarget());
    // add setup action for web modules
    final ConcurrentContextSetupAction setupAction = new ConcurrentContextSetupAction(concurrentContext);
    deploymentUnit.getAttachmentList(Attachments.WEB_SETUP_ACTIONS).add(setupAction);
}
Also used : ConcurrentContextSetupAction(org.jboss.as.ee.concurrent.ConcurrentContextSetupAction) ConcurrentContext(org.jboss.as.ee.concurrent.ConcurrentContext)

Example 2 with ConcurrentContext

use of org.jboss.as.ee.concurrent.ConcurrentContext in project wildfly by wildfly.

the class EEConcurrentContextProcessor method processComponentDescription.

private void processComponentDescription(final ComponentDescription componentDescription) {
    final ComponentConfigurator componentConfigurator = new ComponentConfigurator() {

        @Override
        public void configure(DeploymentPhaseContext context, ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {
            final ConcurrentContext concurrentContext = configuration.getConcurrentContext();
            // setup context
            setupConcurrentContext(concurrentContext, description.getApplicationName(), description.getModuleName(), description.getComponentName(), configuration.getModuleClassLoader(), configuration.getNamespaceContextSelector(), context.getDeploymentUnit(), context.getServiceTarget());
            // add the interceptor which manages the concurrent context
            final ConcurrentContextInterceptor interceptor = new ConcurrentContextInterceptor(concurrentContext);
            final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(interceptor);
            configuration.addPostConstructInterceptor(interceptorFactory, InterceptorOrder.ComponentPostConstruct.CONCURRENT_CONTEXT);
            configuration.addPreDestroyInterceptor(interceptorFactory, InterceptorOrder.ComponentPreDestroy.CONCURRENT_CONTEXT);
            if (description.isPassivationApplicable()) {
                configuration.addPrePassivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.CONCURRENT_CONTEXT);
                configuration.addPostActivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.CONCURRENT_CONTEXT);
            }
            configuration.addComponentInterceptor(interceptorFactory, InterceptorOrder.Component.CONCURRENT_CONTEXT, false);
        }
    };
    componentDescription.getConfigurators().add(componentConfigurator);
}
Also used : ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) ConcurrentContextInterceptor(org.jboss.as.ee.concurrent.ConcurrentContextInterceptor) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) InterceptorFactory(org.jboss.invocation.InterceptorFactory) ImmediateInterceptorFactory(org.jboss.invocation.ImmediateInterceptorFactory) ComponentConfigurator(org.jboss.as.ee.component.ComponentConfigurator) ConcurrentContext(org.jboss.as.ee.concurrent.ConcurrentContext) ImmediateInterceptorFactory(org.jboss.invocation.ImmediateInterceptorFactory) DeploymentPhaseContext(org.jboss.as.server.deployment.DeploymentPhaseContext)

Aggregations

ConcurrentContext (org.jboss.as.ee.concurrent.ConcurrentContext)2 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)1 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 ConcurrentContextInterceptor (org.jboss.as.ee.concurrent.ConcurrentContextInterceptor)1 ConcurrentContextSetupAction (org.jboss.as.ee.concurrent.ConcurrentContextSetupAction)1 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)1 ImmediateInterceptorFactory (org.jboss.invocation.ImmediateInterceptorFactory)1 InterceptorFactory (org.jboss.invocation.InterceptorFactory)1