• Post Reply Bookmark Topic Watch Topic
  • New Topic

basic RMI question.................  RSS feed

 
Max Huang
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the client side, you can retrieve a reference to a remote object using the Naming method. I assume the Naming method communicates with the rmiregistry to get a stub back.
What I don't understand is, you refer to this object on the client side using the subclass of the Remote interface that the server has defined... but why is this remote interface "in scope" on the client side?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client must be compiled with knowledge of the remote type; this is implicit in the reference type and casting work a simple client must do, to wit:

So somewhere the client has access to the "service interface" at compile time.
 
Max Huang
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Ernest:
So somewhere the client has access to the "service interface" at compile time

That makes sense.
Do you know why RMI requires an interface and implementation, instead of just implementation?
I can see how the splitting into interface and class makes development for the client-side easier (ie, doesnt need a copy of the server remote object class implementation in order to compile). Is that the only reason?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like anyone else, I'd have to guess at the design goals that were given at the time RMI was 'specificated.' In its simplest form, I imagine the RMI team felt compile-time guarantees were important.
This convention does not suit CORBA well, as your might imagine, nor does it hold fast in Jiro ERMI implementation (now subsumed into Jini) or the EJB service interfaces. So clearly there are limitations in flexbility by using a compile-time check, but it can also be avoided in a framework that finds this limit counterproductive.
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, "specificated"! Is that English? It doesn't appear in my thesaurus! Please tell me what it means.
Thanks (in advance),
Avi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!