Hi,
I have App A that has one remote object. When app A starts, it will regiser the remote object with RMI registry. App will also start multiple instances of another application (lets say App B).
App A is more like a server, but it also has GUI. So my actual problem here is, I should not allow the user to start more than one instance of App A.I have a logic where everytime the user starts app A, first I check the remote object exists, and if so, I bring the previous instance to foucs.(I know we can use file based or socket based mechanisms to control single instance of an application,but those options are ruled out in my case).
To add to the above issue, we can have our product installed on a network share and multiple users can start the app A. In this case I have to start App A for each user.(Meaning register remote object for every user, not just one copy exists in the registry).
On top of these things, we have to register the object to a unique port(not the well-known 1099 ). So I won't know to which port my object was registered when I started the app A for the first time.
Is there anyway(method available in Naming or InitialContext or Registry) where I can issue a single call and it returns(just the name of the object will be enough,not the actual object-looking for more like a object browser service) all the RMI objects registered with RMI registry at the moment and running.
I tried InitialContext.list(), but again it gives all the objects at one port. I want to get all the Remote objects in one call irrespective of the port to which they are bound.
Thanks in Advance
Arun.
PS:Also I am starting the RMI registry programatically using LocateRegistry method, whereas another collegue wants to start it externally by forking a process that will run the registry in separate JVM. What is the best method to start the registry. Also he argues that we should always use the well-known port(1099) but I want to use on a unique port. I read at the following link that starting the registry externally is not advisible.
http://www.javareference.com/jrexamples/viewexample.jsp?id=8