aspose file tools*
The moose likes Distributed Java and the fly likes RMI Reaper Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Reaper Thread" Watch "RMI Reaper Thread" New topic
Author

RMI Reaper Thread

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Hi, I have a Java application that uses Spring for its RMI needs. I tried to lookup a bean, and it didn't exist, so the application crashed as expected. However, the application hung indefinitely because of the non-daemon thread "RMI Reaper" that was running. Does anyone know what this thread is and why it would hang like this?

Thanks,
Jeff
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

When you say the application crashed, what is it you mean?
You got a Null pointer?
If so, then this means that the request thread died and not the JVM crashed.
RMI creates keep alive threads to keep the VM alive till the point there are no remote objects existing in the JVM.
RMI keeps a count of the number of remote objects exported via RMI.
RMI reaper polls the reference queue for the objects that were exported and hence when these objects are garbage collected, the RMI reaper removes them from its object table and mark it for removal.
RMI reaper keeps the VM alive till the time there are any non-permanent RMI objects alive in the JVM.
Also, this does not mean that the RMI reaper thread is hung, it is just doing its job i.e. waiting for the exported objects to be GCed.


apigee, a better way to API!
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Thanks for that info. By crashed, I mean that I got a Spring exception saying that the bean does not exist. I guess maybe in the "finally" block that launches my application I need to clean up all the beans or something like that (they all cleanup under normal run circumstances).
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

System.exit() is the only way to end an RMI Server. There are other threads active in the RMI Runtime as well.


Ed's latest article: A Java Parallel Calamity http://coopsoft.com/ar/Calamity2Article.html
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Edward Harned:
System.exit() is the only way to end an RMI Server.


Really? Yuk.

CORBA doesn't have that problem - well, not the home-made ORB that we have, anyway. Strange that RMI should be less friendly.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: RMI Reaper Thread