/** * {@inheritDocs} * @see org.jboss.aop.advice.Interceptor#invoke(org.jboss.aop.joinpoint.Invocation) */ public Object invoke(final Invocation invocation) throws Throwable { // If asynchronous if (this.isAsyncInvocation(invocation)) { // Spawn return this.invokeAsync(invocation); } // Regular synchronous call else { // Continue along the chain return invocation.invokeNext(); } }
/** * {@inheritDoc} * @see org.jboss.aop.advice.AspectFactory#createPerClass(org.jboss.aop.Advisor) */ public Object createPerClass(final Advisor advisor) { // Get the container final EJBContainer container = EJBContainer.getEJBContainer(advisor); // Get the metadata final JBossEnterpriseBeanMetaData md = container.getXml(); // Create the interceptor instance AsyncMethodsMetaData asyncMethods = this.getAsyncMethods(md); if (asyncMethods == null) { asyncMethods = new AsyncMethodsMetaData(); } final Object interceptor = new AsynchronousClientInterceptor(asyncMethods); return interceptor; }
final ExecutorService executorService = this.getAsyncExecutor(invocation);