Search in sources :

Example 1 with ConcurrentContextInterceptor

use of org.jboss.as.ee.concurrent.ConcurrentContextInterceptor 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

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