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(); }
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); } }