Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI registry object  RSS feed

 
Jonathan Pengelly
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I have a quick question regarding the 3-tier implementations that used RMI. I am currently registering my business layer remote object in the RMI registry and then I get that object for the user interface. However, now that I think about it, this seems to mean that the same remote object instance will be used by all clients and I think that I want to have a separate instance for each client.
Thus, I have rethought my design and think that I should register a factory object that will build a business layer remote object for the client. Does this seem like a sound, plausible solution?
Regards,
Jonathan
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if you can do this maybe others would know better. Say you create
a remote object and bind it to a name in the registery. Now if you create
another object you cannot rebind it to that name or you lose the first object. I am an RMI beginner also so I could be completely wrong butI would guess that the only way to have access multiple remote objects instances accessible to remote clients is to use multiple registries and/or different names for each object. I don't think this is an avenue you would want to persue. I think one remote object and some kind of static remote interface locator is more than sufficent for the requirements. Remember clarity and ease of undertanding is a much more important requirement than efficency.
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jonathan Pengelly:
Hi guys,
Thus, I have rethought my design and think that I should register a factory object that will build a business layer remote object for the client. Does this seem like a sound, plausible solution?

Yep, that's it. This is the approach to provide unique instances to each client.

Regards,
Jonathan

To follow, here is an exapmple:

I think that's how we can give a unique instance to each client. Client is given a reference to Factory object. He then uses it to get his own RemoteZ.
Guys, if I'm wrong please let me know. Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!