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

RMI Registry stop after timeout

Alex Sasha
Greenhorn

Joined: Sep 02, 2011
Posts: 6
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?
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

The locate is just for a single server.

Use the rmiregistry. It doesn't take much memory. Since it's a Java process, you can control just how much memory is allocated.

Instead of stopping the Servers, look into the Activation framework. You can deactivate a server after an idle period and bring it back up on a call instead of having to restart the server.


Ed's latest article: A Java Parallel Calamity http://coopsoft.com/ar/Calamity2Article.html
Alex Sasha
Greenhorn

Joined: Sep 02, 2011
Posts: 6
i don’t really understand, who gonna start the server as a process? JAF? and how?

i my case it’s a customer requirement to stop all related processes after timeout, rmiregistry should be stopped as well
Edward Harned
Ranch Hand

Joined: Sep 19, 2005
Posts: 291

There is no way to program magically stop the RMIRegistry. Since it is a Java process itself, you will have to figure out some way to do it.
Alex Sasha
Greenhorn

Joined: Sep 02, 2011
Posts: 6
Edward Harned wrote:There is no way to program magically stop the RMIRegistry. Since it is a Java process itself, you will have to figure out some way to do it.

Then i have to write small program that calls LocalRegistry.createRegisty, and stops after idle timeout, that't the only way
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI Registry stop after timeout