use of org.jboss.invocation.Interceptor in project wildfly by wildfly.
the class ContainerManagedConcurrencyInterceptorFactory method create.
@Override
protected Interceptor create(final Component component, final InterceptorFactoryContext context) {
final LockableComponent lockableComponent = (LockableComponent) component;
synchronized (lockableComponent) {
Interceptor interceptor = lockableComponent.getConcurrencyManagementInterceptor();
if (interceptor != null) {
return interceptor;
}
interceptor = new ContainerManagedConcurrencyInterceptor((LockableComponent) component, viewMethodToComponentMethodMap);
lockableComponent.setConcurrencyManagementInterceptor(interceptor);
return interceptor;
}
}
use of org.jboss.invocation.Interceptor in project wildfly by wildfly.
the class TimedObjectInvokerImpl method callTimeout.
@Override
public void callTimeout(final TimerImpl timer, final Method timeoutMethod) throws Exception {
final Interceptor interceptor;
synchronized (this) {
if (!started) {
//this can happen if an invocation has been triggered as the deployment is shutting down
throw EjbLogger.EJB3_TIMER_LOGGER.timerInvocationFailedDueToInvokerNotBeingStarted();
}
interceptor = timeoutInterceptors.get(timeoutMethod);
}
if (interceptor == null) {
throw EjbLogger.EJB3_TIMER_LOGGER.failToInvokeTimeout(timeoutMethod);
}
final InterceptorContext context = new InterceptorContext();
context.setContextData(new HashMap<String, Object>());
context.setMethod(timeoutMethod);
if (timeoutMethod.getParameterTypes().length == 0) {
context.setParameters(new Object[0]);
} else {
final Object[] params = new Object[1];
params[0] = timer;
context.setParameters(params);
}
context.setTimer(timer);
context.putPrivateData(Component.class, ejbComponent.getValue());
context.putPrivateData(MethodIntf.class, MethodIntf.TIMER);
context.putPrivateData(InvocationType.class, InvocationType.TIMER);
interceptor.processInvocation(context);
}
use of org.jboss.invocation.Interceptor in project wildfly by wildfly.
the class TimedObjectInvokerImpl method start.
@Override
public synchronized void start(final StartContext context) throws StartException {
SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
factoryContext.getContextData().put(Component.class, ejbComponent.getValue());
Map<Method, Interceptor> interceptors = new HashMap<Method, Interceptor>();
for (Map.Entry<Method, InterceptorFactory> entry : ejbComponent.getValue().getTimeoutInterceptors().entrySet()) {
interceptors.put(entry.getKey(), entry.getValue().create(factoryContext));
}
this.timeoutInterceptors = interceptors;
started = true;
}
use of org.jboss.invocation.Interceptor in project wildfly by wildfly.
the class ViewService method start.
public void start(final StartContext context) throws StartException {
// Construct the view
View view = new View(privateData);
view.initializeInterceptors();
this.view = view;
final SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
final Component component = view.getComponent();
factoryContext.getContextData().put(Component.class, component);
factoryContext.getContextData().put(ComponentView.class, view);
clientPostConstructInterceptor = clientPostConstruct.create(factoryContext);
clientPreDestroyInterceptor = clientPreDestroy.create(factoryContext);
final Map<Method, InterceptorFactory> clientInterceptorFactories = ViewService.this.clientInterceptorFactories;
clientInterceptors = new IdentityHashMap<Method, Interceptor>(clientInterceptorFactories.size());
for (Method method : clientInterceptorFactories.keySet()) {
clientInterceptors.put(method, clientInterceptorFactories.get(method).create(factoryContext));
}
}
use of org.jboss.invocation.Interceptor in project wildfly by wildfly.
the class AroundConstructInterceptorFactory method create.
@Override
public Interceptor create(final InterceptorFactoryContext context) {
final Interceptor aroundConstruct = aroundConstrctChain.create(context);
return new Interceptor() {
@Override
public Object processInvocation(final InterceptorContext context) throws Exception {
aroundConstruct.processInvocation(context);
context.setParameters(null);
return context.proceed();
}
};
}
Aggregations