I open the rmiregistry thro' the code itself, so need not close it explicitly. When my server is is closed, registry closes by itself. Other than that i don't know any way to close registry on NT except poor man's favourite crtl-C.
Question. If you boot up using the local protocal do you guys require the RMI Registry to be started or do you "switch" it out for local vs remote usage. I have a DataClient that uses a Singleton data service that on first initialization binds an interface into the registry. I didn't want to have the registration based on whether the data client wanted to be local or remote. Any thoughts?
hi all, even i was thinkin on the same line. as u people have been disussing on the RMI registry. can u please tell me the code or syntaxx as to how i start and stop RMI regisrty from code. thanking you in advance sid ------------------ Sid
Sid, you may use java.rmi.registry.Registry registry = java.rmi.registry.LocateRegistry.createRegistry( port ); where the default port is 1099
But how do you gracefully stop it? I think this has not been covered in this thread. I have no idea. I first unbind the bootstraped instance of my dataserver but still there may be lots of DataSession open. There might be some clients currently performing a transaction when I call System.exit().
I think the only clean way is to unbind the bootstrapped instance, stop the registry without a System.exit() (how?) and let all RMI threads finish what they are currently doing (how?). Any idea? Thx Rainer
Hi I am aswell waiting for the answer for the same question 1 start registry using code and bind a instance of RemoteObject but then later if user wants to stop the stop i do the unbind of the remote object. But the RMI registry will still be running how to stop it is it at all possible to stop it Please any one reply Farouk
Hi, All, I am bring this thread up again. I am also looking for code to stop the rmiregistry. The reason I need it is because in my Server GUI, I have a stop button which stops the current session of the Server, not kill the whole server app. Once the user clicks on the stop button, he/she can specify another database to be bound and restart the server. therefore, I need a way either to shut down the RMIRegistry or to check if the RMIRegistry is already open for the port and host (the host is most likely localhost since createRegistry() does not allow you to specify a hostname). Thank you very much! Christy
Hi guys, i would suggest not to think in terms of closing and starting the rmi registry b'cos its not needed once created let it die when the whole application is shut down .. bind and unbind your remote object. and in my design a data(file) can be added or removed from the service hosted no matter if the service is bound or not and i don't think there is one method to close the registry hmmm chked it out but if you find one plz do let me know cheers, parthi.
Even crazy and silly looking problems are sometimes real.
Joined: Oct 15, 2001
Hi, Parthi, Totally good idea!!! I am doing the same now (just binding and unbinding my database now No more searching the closing the RMIRegistry. How come I did not think about earlier Christy