@Override public Object processInvocation(final InterceptorContext context) throws Exception { final InvocationType marker = context.getPrivateData(InvocationType.class); if (marker == InvocationType.TIMER) { return aroundTimeout.processInvocation(context); } else { return aroundInvoke.processInvocation(context); } } };
@Override public Object invoke(InterceptorContext interceptorContext) throws Exception { if(component instanceof BasicComponent) { ((BasicComponent) component).waitForComponentStart(); } final Method method = interceptorContext.getMethod(); final Interceptor interceptor = viewInterceptors.get(method); return interceptor.processInvocation(interceptorContext); }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { aroundConstruct.processInvocation(context); context.setParameters(null); return context.proceed(); } };
@Override public Object processInvocation(final InterceptorContext context) throws Exception { StatefulSessionComponentInstance instance = (StatefulSessionComponentInstance) context.getPrivateData(ComponentInstance.class); return instance.getEjb2XRemoveInterceptor().processInvocation(context); } }
@Override public void release() { try { InterceptorContext interceptorContext = new InterceptorContext(); interceptorContext.putPrivateData(ComponentView.class, componentView); interceptorContext.putPrivateData(Component.class, component); clientPreDestroyInterceptor.processInvocation(interceptorContext); } catch (Exception e) { ROOT_LOGGER.preDestroyInterceptorFailure(e, component.getComponentClass()); } }
/** * {@inheritDoc} */ public final void destroy() { if (doneUpdater.compareAndSet(this, 0, 1)) try { preDestroy(); final Object instance = getInstance(); if (instance != null) { final InterceptorContext interceptorContext = prepareInterceptorContext(); interceptorContext.setTarget(instance); interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY); preDestroy.processInvocation(interceptorContext); } } catch (Exception e) { ROOT_LOGGER.componentDestroyFailure(e, this); } finally { component.finishDestroy(); } }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
@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); }
context.putPrivateData(entry.getKey(), entry.getValue()); clientPostConstructInterceptor.processInvocation(context); instance.constructionComplete();
public Object processInvocation(final InterceptorContext context) throws Exception { ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); if (componentInstance == null) { throw EeLogger.ROOT_LOGGER.noComponentInstance(); } Method oldMethod = context.getMethod(); try { context.setMethod(componentMethod); context.setTarget(componentInstance.getInstance()); return componentInstance.getInterceptor(componentMethod).processInvocation(context); } finally { context.setMethod(oldMethod); context.setTarget(null); } } }
postConstructInterceptor.processInvocation(interceptorContext); } catch (Exception e) { throw EeLogger.ROOT_LOGGER.componentConstructionFailure(e);
private Object execute(final Interceptor interceptor, final Method method, final Object... parameters) { if (interceptor == null) return null; final InterceptorContext interceptorContext = new InterceptorContext(); //we need the method so this does not count as a lifecycle invocation interceptorContext.setMethod(method); interceptorContext.putPrivateData(Component.class, getComponent()); interceptorContext.putPrivateData(ComponentInstance.class, this); interceptorContext.putPrivateData(InvokeMethodOnTargetInterceptor.PARAMETERS_KEY, parameters); interceptorContext.setContextData(new HashMap<String, Object>()); interceptorContext.setTarget(getInstance()); final AbstractTransaction transaction = ContextTransactionManager.getInstance().getTransaction(); interceptorContext.setTransactionSupplier(() -> transaction); try { return interceptor.processInvocation(interceptorContext); } catch (Error e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new EJBException(e); } }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { final InvocationType marker = context.getPrivateData(InvocationType.class); if (marker == InvocationType.TIMER) { return aroundTimeout.processInvocation(context); } else { return aroundInvoke.processInvocation(context); } } };
@Override public Object processInvocation(final InterceptorContext context) throws Exception { final InvocationType marker = context.getPrivateData(InvocationType.class); if (marker == InvocationType.TIMER) { return aroundTimeout.processInvocation(context); } else { return aroundInvoke.processInvocation(context); } } };
@Override public Object processInvocation(final InterceptorContext context) throws Exception { final InvocationType marker = context.getPrivateData(InvocationType.class); if (marker == InvocationType.TIMER) { return aroundTimeout.processInvocation(context); } else { return aroundInvoke.processInvocation(context); } } };
@Override public Object invoke(InterceptorContext interceptorContext) throws Exception { final Method method = interceptorContext.getMethod(); final Interceptor interceptor = viewInterceptors.get(method); return interceptor.processInvocation(interceptorContext); }
/** * Pass the invocation on to the next step in the chain. * * @return the result * @throws Exception if an invocation throws an exception */ public Object proceed() throws Exception { if (interceptorPosition < interceptors.length) { Interceptor next = interceptors[interceptorPosition++]; try { return next.processInvocation(this); } finally { interceptorPosition--; } } else { throw msg.cannotProceed(); } }
@Override public Object invoke(InterceptorContext interceptorContext) throws Exception { if(component instanceof BasicComponent) { ((BasicComponent) component).waitForComponentStart(); } final Method method = interceptorContext.getMethod(); final Interceptor interceptor = viewInterceptors.get(method); return interceptor.processInvocation(interceptorContext); }
@Override public Object invoke(InterceptorContext interceptorContext) throws Exception { if(component instanceof BasicComponent) { ((BasicComponent) component).waitForComponentStart(); } final Method method = interceptorContext.getMethod(); final Interceptor interceptor = viewInterceptors.get(method); return interceptor.processInvocation(interceptorContext); }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { aroundConstruct.processInvocation(context); context.setParameters(null); return context.proceed(); } };