RMI cleanup

mvanr <[email protected]> Wed, 29 Apr 2009 23:55:23 -0700
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
I recently had a problem where a dual quad-core xeon was brought to its knees
and this was traced back to RMI clients experiencing an io exception, and
repeatedly retrying the operation every second.  Here's the code:

while (true) try
{
	if (remote == null) try {
		remote = (T)Naming.lookup(serviceName);
	}
	catch (Exception ex) {
		throw new RemoteException(ex.getClass().getName() + ": " +
ex.getMessage());
	}
	op.exec(remote);
		return;
}
catch (IOException ex) {
	remote = null;
	Thread.sleep(1000);
}

The call to naming lookup was succeeding. The call to op.exec just
translates to a call of a method on the remote object, and that was throwing
a host not found exception due to a misconfiguration on the server.

I would have expected the discarded remote objects to be cleaned up shortly
after the exception, but it seems that they are not.  What's worse is that
they continue to consume CPU.  Half a dozen of these java programs caused
the load on the server to get close to 1000.

Does anyone know how best to avoid this?  I would prefer an in-code solution
to a command line argument to java, since the latter could always be
forgotten.

Thanks.
-- 
View this message in context: http://www.nabble.com/RMI-cleanup-tp23310928p23310928.html
Sent from the Java - RMI mailing list archive at Nabble.com.

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html