This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
RMI experts-> createRegistry and a stupid argument...
aadhi agathi
Ranch Hand
Joined: Apr 29, 2002
Posts: 263
posted
0
Hi Ranchers, in my server start, i am asking the registry port, server port and host name (3 args). i am using Naming.bind and Naming.lookup.
when i have to start the registry programatically , it works, irrrespective of the any_integer i am passing. so i am planning to abondon the registry port input. i am also planning to keep at as it never hurts(just one more param). will it be OK. i am not sure though , it may turn out that the port/any_integer is the basic of RMI. what is the use of the argument in LocateRegistry.createRegistry(int). is Naming so superior, that it can find the registered obects in any port.
from 1.4 API Creates and exports a Registry on the local host that accepts requests on the specified port.
please help!!! Any notes will open a door to me in RMI. [ March 20, 2003: Message edited by: aadhi agathi ]
Aadhi
aadhi agathi
Ranch Hand
Joined: Apr 29, 2002
Posts: 263
posted
0
What more, i can start the registries on two different ports and bind a server with the same name. God knows, when somebody is doing a lookup using Naming.lookup(), it will use which registry and which object will be found. when i tried to do a Registry.bind, it doesn't work! that makes me suspicious. I have tried to start the registry 1t port 1099 and 1001 in that order , then bind the server. when the client says lookup 1001 registry is used the, I have tried to start the registry 1t port 1001 and 1099 in that order , then bind the server. when the client says lookup 1009 registry is used. so whenever i say bind , it erases the old copy and the new copy is used!! then what is the use of createRegistry ( ) at some port??? any help!! [ March 20, 2003: Message edited by: aadhi agathi ]
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
posted
0
in my server start, i am asking the registry port, server port and host name (3 args).
What is the server port if you bind your remote object to a specific port in the registry? What do you need a host name for, -- it's always localhost to the server. In fact, you don't need to specify the host at all:
It's the client that should specify the host name, not the server. Eugene.
aadhi agathi
Ranch Hand
Joined: Apr 29, 2002
Posts: 263
posted
0
Originally posted by Eugene Kononov:
It's the client that should specify the host name, not the server. Eugene.
so i have always use rmi://"+hostName+ "/"+port,Object . anyway feel good to get it clarified But what about the createRegistry
would i use getRegistry() instead of ,createRegistry(int port)
am i correct. but i am still curious about the createRegistry, what purpose does it serve!!! pls put in your comments!
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
posted
0
so i have always use rmi://"+hostName+ "/"+port,Object . anyway feel good to get it clarified
There is Naming.rebind() and Registry.rebind(). The former one takes a URL-formatted String, the latter one takes just a String. The Java doc for Registry.rebind() was actually wrong up until JDK 1.4.0 where Sun finally fixed it. Eugene.
aadhi agathi
Ranch Hand
Joined: Apr 29, 2002
Posts: 263
posted
0
Originally posted by Eugene Kononov:
There is Naming.rebind() and Registry.rebind(). Eugene.
for me, the Registry.rebind() doesn't work! i am using Naming.rebind(String). but what about starting the registry. what to use 1.createRegistry(int port) or 2.getRegistry() i am confused on the part of creating the registry, dynamically. These two methods are not identical, as one takes a port. i dont know<B>how this port makes a difference</B> Thanks much for the help!! [ March 21, 2003: Message edited by: aadhi agathi ]