Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

RMI, Sockets and Cleanup

Thread view: 
Volker Raum - 27 Mar 2007 16:17 GMT
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
Esmond Pitt - 28 Mar 2007 04:12 GMT
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.