Hello there, the classes RmiClientInterceptor and RmiProxyFactoryBean that fzhong has mentioned as a model implementation are both parts of Spring. In particular, the invoke method is in the RmiClientInterceptor.
Both classes sit in package org.springframework.remoting.rmi in jar org.springframework.context-sources-3.1.0.M1.jar of the Spring framework source distribution. -- Sebastian > -----Original Message----- > From: ant elder [mailto:ant.el...@gmail.com] > Sent: Thursday, March 17, 2011 12:17 PM > To: user@tuscany.apache.org > Subject: Re: Tuscany 1.6 RMI bug: ConnectException after component > restart > > I'm having some trouble finding where that code is you're suggesting > to change, where is that invoke method - is it a Tuscany class or a > Spring - what is the class and package name? > > ...ant > > On Wed, Mar 16, 2011 at 1:44 AM, fzhong <fzh...@travelsky.com> wrote: > > Hi all, > > I had encountered this problem,In fact,the implementation of RMI > references > > is simple,it lacked the capacity to respond to some exception.The > Spring rmi > > client is a good > > job(org\springframework\remoting\rmi\RmiProxyFactoryBean,you can find > more > > details in class RmiClientInterceptor),it provides a > > refreshStubOnConnectFailure property,that indicate > > whether to refresh the RMI stub on connect failure. (If a cached RMI > stub throws an RMI exception that indicates a > > remote connect failure, a fresh proxy will be fetched and the > > invocation will be retried.) The lookupStubOnStartup and cacheStub > are also > > helpful properties,you can learn more from the spring source code. > > > > Need of special note is if we use the spring rmi client to connect > the rim > > service that is exposed by Tuscany RMI Service,although,the property > > refreshStubOnConnectFailure of RmiProxyFactoryBean class set to be > true,we > > will still encounter an exception. > > You should modify invoke method of the RmiClientInterceptor class to > do > > with UndeclaredThrowableException, > > Details is : > > > > public Object invoke(MethodInvocation invocation) throws Throwable { > > Remote stub = getStub(); > > try { > > return doInvoke(invocation, stub); > > } catch (RemoteConnectFailureException ex) { > > return handleRemoteConnectFailure(invocation, ex); > > } catch (RemoteException ex) { > > if (isConnectFailure(ex)) { > > return handleRemoteConnectFailure(invocation, ex); > > } else { > > throw ex; > > } > > } catch (UndeclaredThrowableException ex) {// > > return handleRemoteConnectFailure(invocation, ex); > > } > > } > > > > The tuscany rmi service and reference may some improvement,Spring > related > > implementation is a good reference .Thank you > > 2011-03-16 > > ________________________________ > > fzhong > > ________________________________