/** * @see #proceed() */ public Object proceed() throws Throwable { return invocation.invokeNext(); }
public Object invoke(Invocation invocation) throws Throwable { if (isLocal()) { String guid = (String)invocation.getMetaData(IS_LOCAL, GUID); Container container = Ejb3Registry.getContainer(guid); return invokeLocal(invocation, container); } return invocation.invokeNext(); }
private Object interceptFieldGet(Invocation invocation, Method reflectionMethod, Object targetObject, Object[] args) throws Throwable { Field field = (Field) invocation.getTargetObject(); Matcher m = fieldGetPattern.matcher(reflectionMethod.getName()); if (m.matches()) { Object instance = args[0]; return interceptFieldRead(invocation, field, instance); } return invocation.invokeNext(); }
/** * Copy constructor. */ public InvocationBase(Invocation invocation) { this.interceptors = invocation.getInterceptors(); setTargetObject(invocation.getTargetObject()); }
public Object invoke(Invocation invocation) throws Throwable { if (new CFlowMatcher().matches(expr, invocation)) { Invocation wrapper = invocation.getWrapper(chain); return wrapper.invokeNext(); } // no match for cflow so just go down chain return invocation.invokeNext(); } }
/** * Sets the TCCL to the classloader of the container so * that the invocation happens in the context of the * container's classloader. Finally upon return resets * the TCCL to the previous classloader. */ public Object invoke(Invocation invocation) throws Throwable { assert invocation instanceof EJBContainerInvocation : "Unexpected invocation type " + invocation.getClass() + " - expected " + EJBContainerInvocation.class; // get hold of the EJBContainer from the invocation EJBContainer ejbContainer = EJBContainer.getEJBContainer(invocation.getAdvisor()); ClassLoader ejbContainerClassloader = ejbContainer.getClassloader(); ClassLoader previousClassLoader = Thread.currentThread().getContextClassLoader(); // TODO: Review for security manager privileged blocks try { // Set the TCCL to the EJBContainer's classloader Thread.currentThread().setContextClassLoader(ejbContainerClassloader); // move on return invocation.invokeNext(); } finally { // reset to original TCCL Thread.currentThread().setContextClassLoader(previousClassLoader); } }
public Object invoke(Invocation invocation) throws Throwable Object target = invocation.getTargetObject(); Object message = invocation.getMetaData().getMetaData(ConsumerContainer.CONSUMER_MESSAGE, ConsumerContainer.CONSUMER_MESSAGE); if (fields != null) return invocation.invokeNext();
if (callingObject == null) return invocation.invokeNext(); // called from static method Object targetObject = invocation.getTargetObject(); if (targetObject == null) return invocation.invokeNext(); // static method call or static field call Advisor advisor = invocation.getAdvisor(); if (advisor == null) return invocation.invokeNext(); return invocation.invokeNext(); return invocation.invokeNext();
VersionedObject manager = (VersionedObject)invocation.getMetaData(Versioned.VERSIONED, Versioned.VERSIONED_OBJECT); invocation.setTargetObject(version); return invocation.invokeNext(); if (invocation instanceof MethodInvocation) String readonly = (String)invocation.getMetaData(Versioned.VERSIONED, Versioned.READONLY); if (readonly != null) if (isReadonly) return invocation.invokeNext(); invocation.setTargetObject(version); return invocation.invokeNext();
@Override public Object invoke(Invocation invocation) throws Throwable { Object response = invocation.invokeNext(); String clientFamily = (String) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_FAMILY); HATarget target = families.get(clientFamily); if (target == null) { return response; } Long clientViewId = (Long) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_VIEW_ID); if (clientViewId == null) { // Maybe we're being invoked upon by a non-clustered proxy return response; } if (clientViewId.longValue() != target.getCurrentViewId()) { invocation.addResponseAttachment("replicants", new ArrayList<Object>(target.getReplicantList())); invocation.addResponseAttachment("viewId", new Long(target.getCurrentViewId())); } return response; } }
public static Object getMetadata(Invocation invocation, Object key) { return invocation.getMetaData().getMetaData(CLIENT_METADATA, key); }
public Object invoke(Invocation invocation) throws Throwable { if (isLocal()) { Object oid = invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID); if (Dispatcher.singleton.isRegistered(oid)) { InvocationResponse response = Dispatcher.singleton.invoke(invocation); invocation.setResponseContextInfo(response.getContextInfo()); return response.getResponse(); } } return invocation.invokeNext(); }
@SuppressWarnings("unchecked") public static <C extends EJBContainer> C getEJBContainer(Invocation invocation) { // Because of Sun JDK we must cast it to something, or else there will be // no upper bound. return (C) EJBContainer.getEJBContainer(invocation.getAdvisor()); }
protected static <T extends Annotation> T resolveAnnotation(Invocation invocation, Class<?> cls, Class<T> annotationType) { return ExtendedAdvisorHelper.getExtendedAdvisor(invocation.getAdvisor(), invocation.getTargetObject()).resolveAnnotation(cls, annotationType); } }
protected Object invokeLocal(Invocation invocation, Container container) throws Throwable { Invocation copy = marshallOrPass(invocation, Invocation.class); copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS); try { // Invoke upon the container SessionContainer sc = (SessionContainer) container; InvocationResponse response = sc.dynamicInvoke(copy); // it could really have been a copy invocation.setResponseContextInfo(response.getContextInfo()); return marshallOrPass(response.getResponse(), Object.class); } // TODO: Either Throwable (as it used to be) or Exception (which is better) catch(Throwable t) { throw marshallOrPass(t, Throwable.class); } finally { copy.getMetaData().removeMetaData(IS_LOCAL, IS_LOCAL); } }
final Invocation nextInvocation = invocation.copy(); nextInvocation.getMetaData().addMetaData(INVOCATION_METADATA_TAG, INVOCATION_METADATA_ATTR, INVOCATION_METADATA_VALUE);
public Object invoke(org.jboss.aop.joinpoint.Invocation invocation) throws Throwable Object target = invocation.getTargetObject(); if (target instanceof Advised)
/** * @see org.jboss.aop.advice.Interceptor#invoke(org.jboss.aop.joinpoint.Invocation) */ public Object invoke(Invocation invocation) throws Throwable { EJBContainer container = EJBContainer.getEJBContainer(invocation.getAdvisor()); Lock lock = container.getInvocationLock(); // We intentionally do not use tryLock() since it does not respect lock fairness if (!lock.tryLock(0, TimeUnit.SECONDS)) { throw new DispatcherConnectException("EJB container is not completely started, or is stopped."); } try { return invocation.invokeNext(); } finally { lock.unlock(); } } }
if (callingObject == null) return invocation.invokeNext(); // called from static method Object targetObject = invocation.getTargetObject(); if (targetObject == null) return invocation.invokeNext(); // static method call or static field call Advisor advisor = invocation.getAdvisor(); if (advisor == null) return invocation.invokeNext(); return invocation.invokeNext(); return invocation.invokeNext();
public static void addMetadata(Invocation invocation, Object key, Object value) { invocation.getMetaData().addMetaData(CLIENT_METADATA, key, value); }