I have several RMI servers , that are working, and if they have nothing to do they stop after idle timeout. When client starts if tests if the server is working and if not then it starts the server. There are two possibility to start RMI Registry LocalRegistry.createRegistry or starting it in a separate process rmiregistry.
If I use the first solution as soon the first server stops all other serves stay running but without registry and client can’t find them.
If I use the second solution rmiregistry is working forever till it’s stopped manually, and that is not good, because it should free memory after idle timeout.
The only solution for this problem I see is to write separate server that is creating registry using LocalRegistry.createRegistry inside itself, and stops after all servers are unregistered(the question is how to recognize this situation) and after idle timeout. Is the any simpler solution?