• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Service is a method or an object?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am new to RMI and was going through some sample code. I have a doubt here. The Naming.rebind() method makes the server object available to the registry. From client I can access using Naming.lookup(), am I accessing the object or the methods only? What is the service in this context - object or a method?

Also the Naming.lookup() takes only the registry hostname. How does it differentiate between various services offered by the server and also various objects created by the server?

The actual network connection is through TCP/IP. Is the connection on a per call basis or some session is maintained?

Would be grateful to get responses.

Thanks n Regards,
navEEn
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're confusing some terms about "object" and "methods" - what you are accessing from the registry is the Stub of your server - it's an object, and through it you can access the remote methods that your server provides. A "service" is an object that provides a set of methods to a client - it's not exactly the same as your server object, because you can't get at non-remote methods, but it's still an object.

The registry differentiates between different services provided by using different names - Naming.lookup() takes more than just the hostname - it also takes the name of the service you are looking up. The name used in Naming.lookup() by the client must agree with the name used when calling Naming.bind() by the server.

I'm not completely sure if this is the answer you are looking for about the "per-call basis" - but each RMI method call creates a new TCP/IP connection - any sort of "session" information would be maintained by the server object itself, not anything in the protocol or provided inherently by any RMI internals. You can find a lot more information about RMI internals in this article if you're interested in digging deeper.
 
naveen chinthakunta
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thank you for the clarification. Now I get "service" and "objects" straight. But my doubt regarding Naming.lookup() persists. I was going through the Java 2 documentation, the lookup() method takes only the URL as the argument. Still not clear how the various services provided by the same server are distinguished.

Thanks in advance.
navEEn
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just looked at the JavaDoc for Naming - it's confusing if you just look at the lookup() method by itself. Read the documentation at the top for the entire Naming class - it explains how the URL is used... the host:port part tells what registry you are using - the name part specifies a specific service running in that registry.

[NP - edited to disable smilies]
[ November 03, 2005: Message edited by: Nathan Pruett ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic