Mike Peters wrote:I don't know how to handle that in an elegant way (i.e. the mechanism will pollute the client code). What is your solution?
May be you can spend some time looking into creating a decorator over the actual stub that does a reconnect when it gets a remote exception. Something like:
All your client code interacts with the above decorator and not the actual stub. So, none of them actually has to care about stub refresh.
You can even look at dynamic proxies if you have a lot of such stubs and you do not want to write a new decorator for every server stub that you have.