This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.
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).