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
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.
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.
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.