javaclient-serverrmirmiregistry

RMI: check client crash


I am programming a simple client/server application using Java-RMI. I would like to know when all clients died, in order to shut the server down. After having done some research on the web, I found out that I could make my server implement the Unreferenced interface and define the unreferenced() method. But this seems not to work, and I think it is because the server is bound to the RMI-Registry, which probably holds a reference on it.

Does anybody have an idea of how I could get notified when all clients crashed in my case?

Thanks


Solution

  • I think it is because the server is bound to the RMI-Registry, which probably holds a reference on it.

    You are correct, the RMIRegistry also counts as a client for DGC/Unreferenced purposes.