This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A conundrum - RMI remote or Local reference

 
Douglas Kent
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm dealing with a situation where I am implementing RMI for the communications. I've got an client object instantiating a local copy of Data for local use, depending on user selection. In that same object, if the user chooses remote, I get a reference to a remote "servant" which wraps one local (as far as the server is concerned) copy of Data. I would like to use one reference in the client object to either the local Data or the remote "servant", but can't get a common reference. Has anyone else dealt with this, and how have you solved it? One way (brute-force) would be to remember which way (local or remote) and keep separate references and invoke the appropriate one.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to use both the remote and the local Data as if they were the same type, yet their implementations differ considerably. Hmmm... isn't that what interfaces were created for?
interface DataInterface...
class Data implements DataInterface...
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic