What are the RMI Failure modes?

I was surprised today when I pulled the network. My client was working with my server. Between calls I disconnected the connection. Made a call which failed. Then reconnected. The next call performed full speed. I expected a 'reconnection' delay.

Why was the first call slow, but all subsequent calls quick, as well as calls after I reconnected the network were quick? It leads me to believe that exporting an object the first time takes some time. But subsequent calls to the object that was already exported went quicker. Or perhaps my client downloaded some classes?

So the question is, when does the connection die in such a way that the client needs to re-download classes it has downloaded? Is this only after the client JVM exits? Also, where are the downloaded classes kept?

Second question is, how long are my client held remote objects valid? If the connection dies, how long will they remain valid for use, and how can I detect when they are no longer valid? How can I know the difference between an invalid reference and a broken connection? Is there a difference?

[1103 byte] By [_dnoyeBa] at [2007-11-26 16:06:25]
# 1

1. There is a good chance that your first call was slow due to DNS problems.

2. Your client will know when a connection dies when it tries to communicate and it fails.

3. "Invalid reference" is vague. But you should probably assume that when you try a remote method, and you get a RemoteException, that something has happened that will require a new refernce to be retrieved.

bschauwejavaa at 2007-7-8 22:28:35 > top of Java-index,Core,Core APIs...
# 2

Its not a DNS problem. I am using localhost through ssh. It seems to be the first call that takes the time. Im thinking its the class downloading thats hurting me. Any way to validate that?

If the network cable gets pulled, the clients references to not become invalid. This only happens when the DGC kick in AFAICT. So these references will remain good for a time. I could hold on to them and next attempt, use the same ones again. As it stands I dump everything but its not always necessary. Its not that taxing to dump everything so its no big deal, I just wanted to know though.

_dnoyeBa at 2007-7-8 22:28:35 > top of Java-index,Core,Core APIs...