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); } } }
/** * {@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(); } }
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); } }
public Object processInvocation(final InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); final ManagedReference existing = (ManagedReference) componentInstance.getInstanceData(contextKey); if (existing == null) { final ManagedReference reference = componentFactory.create(context); boolean ok = false; try { componentInstance.setInstanceData(contextKey, reference); if (setTarget) { context.setTarget(reference.getInstance()); } Object result = context.proceed(); ok = true; return result; } finally { if (!ok) { reference.release(); componentInstance.setInstanceData(contextKey, reference); } } } else { return context.proceed(); } }
interceptorContext.setMethod(method); interceptorContext.setTransaction(invocation.getTransaction()); interceptorContext.setTarget(invocation.getInvokedProxy());
public Object processInvocation(final InterceptorContext context) throws Exception { final ManagedReference existing = referenceReference.get(); if (existing == null) { final ManagedReference reference = componentInstantiator.getReference(); boolean ok = false; try { referenceReference.set(reference); context.setTarget(reference.getInstance()); Object result = context.proceed(); ok = true; return result; } finally { context.setTarget(null); if (!ok) { reference.release(); referenceReference.set(null); } } } else { return context.proceed(); } } }
protected Object invokeFind(final InterceptorContext context, final EntityBeanComponentInstance instance) throws Exception { Method oldMethod = context.getMethod(); try { context.putPrivateData(ComponentInstance.class, instance); context.setMethod(finderMethod); context.setTarget(instance.getInstance()); return instance.getInterceptor(finderMethod).processInvocation(context); } finally { context.setMethod(oldMethod); context.setTarget(null); context.putPrivateData(ComponentInstance.class, null); } }
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); } } }
public Object processInvocation(final InterceptorContext context) throws Exception { ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); if (componentInstance == null) { throw MESSAGES.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); } } }
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); } } }
/** * {@inheritDoc} */ public final void destroy() { if (doneUpdater.compareAndSet(this, 0, 1)) try { preDestroy(); final ManagedReference reference = instanceReference.get(); if (reference != null) { final InterceptorContext interceptorContext = prepareInterceptorContext(); interceptorContext.setTarget(reference.getInstance()); interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY); preDestroy.processInvocation(interceptorContext); } } catch (Exception e) { ROOT_LOGGER.componentDestroyFailure(e, this); } finally { component.finishDestroy(); } }
/** * {@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 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(); } }
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()); 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 { //grab a bean from the pool to invoke the business method on final EntityBeanComponentInstance instance = component.acquireUnAssociatedInstance(); final Object result; final InvocationType invocationType = context.getPrivateData(InvocationType.class); try { context.putPrivateData(InvocationType.class, InvocationType.HOME_METHOD); //forward the invocation to the component interceptor chain Method oldMethod = context.getMethod(); try { context.putPrivateData(ComponentInstance.class, instance); context.setMethod(businessMethod); context.setTarget(instance.getInstance()); return instance.getInterceptor(businessMethod).processInvocation(context); } finally { context.setMethod(oldMethod); context.setTarget(null); context.putPrivateData(ComponentInstance.class, null); } } finally { context.putPrivateData(InvocationType.class, invocationType); component.releaseEntityBeanInstance(instance); } } };
public Object processInvocation(final InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); final ManagedReference existing = (ManagedReference) componentInstance.getInstanceData(contextKey); if (existing == null) { final ManagedReference reference = componentFactory.create(context); boolean ok = false; try { componentInstance.setInstanceData(contextKey, reference); if (setTarget) { context.setTarget(reference.getInstance()); } Object result = context.proceed(); ok = true; return result; } finally { if (!ok) { reference.release(); componentInstance.setInstanceData(contextKey, reference); } } } else { return context.proceed(); } }
public Object processInvocation(final InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); final ManagedReference existing = (ManagedReference) componentInstance.getInstanceData(contextKey); if (existing == null) { final ManagedReference reference = componentFactory.create(context); boolean ok = false; try { componentInstance.setInstanceData(contextKey, reference); if (setTarget) { context.setTarget(reference.getInstance()); } Object result = context.proceed(); ok = true; return result; } finally { if (!ok) { reference.release(); componentInstance.setInstanceData(contextKey, reference); } } } else { return context.proceed(); } }
context.setMethod(method); context.setParameters(wsInvocation.getArgs()); context.setTarget(reference.getInstance()); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView);
context.setParameters(parameters); context.setMethod(method); context.setTarget(invocation.getInvokedProxy()); context.setContextData(new HashMap<String, Object>()); context.putPrivateData(Component.class, ejbComponent);