/** * Handles remote methods. * @throws POJOInvocationHandlerException if a server cannot be chosen * @throws Throwable if the invoked method throws an exception **/ @Override protected Object invokeRemoteMethod(final Object proxy, final Method method, final Object... args) throws POJOInvocationHandlerException, Throwable { // Use the same classloader that during the creation of this object ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); setClassLoader(oldClassLoader); try { return super.invokeRemoteMethod(proxy, method, args); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } }
return super.invokeRemoteMethod(proxy, method, args); } catch(Exception e) { if(e instanceof EJBException) {
/** * Return a stub of {@link EJBObject} wrapped with its CMIReference. * @param proxy a CMI proxy * @param method a create (or find) method * @param args method arguments * @return a wrapper containing a stub of EJBObject and its CMIReference * @throws Throwable if the stub cannot be downloaded */ public CMIReferenceableWrapper<EJBObject> getWrappedEJBObject( final Object proxy, final Method method, final Object... args) throws Throwable { // Get a stub of EJBObject EJBObject ejbObject = (EJBObject) super.invokeRemoteMethod(proxy, method, args); // Wrap it with its associated CMIReference return new CMIReferenceableWrapper<EJBObject>(getCurrentRef().getReference(), ejbObject); }
EJBMetaData ejbMetaDataRaw = (EJBMetaData) super.invokeRemoteMethod(proxy, ejbMetaDataMethod); boolean session = ejbMetaDataRaw.isSession(); ejbMetaData = new JMetaData( } else if(methodName.equals("getEJBMetaData")) { if(ejbMetaData == null) { EJBMetaData ejbMetaDataRaw = (EJBMetaData) super.invokeRemoteMethod(proxy, method, args); setCurrentRef(null); boolean session = ejbMetaDataRaw.isSession();