RMI, Sockets and Cleanup

V

Volker Raum

Hi everyone,

i am having potential trouble (it maybe becomes trouble)
with RMI Socket Usage and RMI Exceptions.

I coded an RMI server and a client.
I set hard Socket Timeouts using my own Socket Factories, so sometimes Exceptions occur, when the
client calls a servers remote method and the network is in an unfomfortable mood. This is ok, and i
react on it by waiting a bit, trying to lookup the servers remote again and continue my work.
My question is: What propper cleanup do i have to do in a case of exception?
What do i do with the RemoteObject (Proxy) after an exception occured on the client?
Do i have to do anything with the registered Object on the Server?

I ran a netstat on the server.
After the Client got an RMI Timeout Exception, i looked up the ServerRemote in the Registry again
and continued my work.
After doing this for several times, not restarting the server, the server netstat showed more
TCPIP connections than after the first lookup of the client.
Even after i gave the server some time( 1 hour), the TCPIP connections remained.
After Terminating the client some connections are removed, some remain and i think the number of
connections still present is equal to the number of the clients reconnects after an exception.
=> Do Sockets (Connections) get spoiled here?

Any ideas, knowledge here?

thanx,
Volka
 
E

Esmond Pitt

Volker said:
My question is: What propper cleanup do i have to do in a case of
exception?
None.

What do i do with the RemoteObject (Proxy) after an exception occured on
the client?

Nothing except maybe reacquire it, as you are doing, making sure to
discard the old one for GC and DGC purposes.
Do i have to do anything with the registered Object on the Server?
No.

After Terminating the client some connections are removed, some remain

Any connections that remain after the client JVM exits are probably
between the server and the registry, or else have nothing to do with RMI.
and i think the number of connections still present is equal to the
number of the clients reconnects after an exception.

If the client JVM has exited this is not possible, as all its
connections will have been terminated by the operating system.
=> Do Sockets (Connections) get spoiled here?

No.

You need to know that there are connections between the client and the
Registry, the Registry and the server, and the client and the server,
for DGC purposes, as well as connections from the client to the Registry
for lookup() and list() purposes and connections from client to server
for remote method invocations. All these connections should terminate
after 15 seconds of idleness at the client, or an hour or two of
idleness at the server, unless you have modified the system properties
that control these RMI connection timeouts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top