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);
}
Aggregations