• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions about "Get smart with proxies and RMI" in JavaWorld

 
Leo Tai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am doing FBN assignment and use RMI approach. I just finished the LockManager. Now I am facing some RMI design problems. How can I get the a unique client Id?
I searched this forum, and many people suggest using RMI factory pattern to create an remote object. It can then be used as a client identity. The RMI factory is just similar to DoorServer in the JavaWorld article - "Get smart with proxies and RMI". Any comments?
Then, what is the use of DoorProxy? Does it just abstract one more level of DoorRemote Implementation? What if I make it as the proxy of remote and local implementation? More complex? More elegant?
Cheers,
Leo Tai
[ May 29, 2003: Message edited by: Leo Tai ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo,
Please post URLs for referenced articles or code - it will make it easier for interested parties to also read them.
For anyone interested, the JavaWorld article is here.
Going away to read it now ....
Regards, Andrew
 
Leo Tai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, Yes! Thanks! I just edit my post!
Any help would be very much appreciated.
Cheers,
Leo
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While only skimming briefly through the intro, I would say that the designs suggested here are not quite like that of the article.
It appears that the article is showing how the class on the client side that passes calls to the remote object, is there to enhance and add more functionality to that class.
In the FBN assignment, you don't need to enhance or add more functionality to the DataAccessRemote class. Meaning that the calls are the same to a Remote Object as in the DataAccessRemote, as are the calls to the DataAccessLocal class.
These classes implement the DataAccess interface which has all the public classes of the Data class and the unreferenced method for those that also implement the Unreferenced interface, which I recommend.
Then the Factory classes are such as.
1. ConnectionFactory class, this is the class that is bound to the RMIRegistry. This returns new instances of the DataAccessRemote class, which resides on the server for the client and acts as the unique identifier for the client.
2. DataAccessFactory. Based on the command line arguments, or setup screen, this class returns either an instance of the DataAccessRemote class which it receives from the above factory, or a DataAccessLocal class which it instantiates for the client here.
This is the simplest and easiest solution for the FBN assignment.
Good Luck
Mark
 
Leo Tai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Mark! Your suggested solution is clear and simple.
I wish I don't have any misunderstanding on your words and the JavaWorld article. In the JavaWorld article, it uses RMI in three levels.
- Level 1 is the conventional use of RMI, which cannot solve my unqiue client ID problems.
- Level 2 shows the use RMI factory pattern, which can solve my problem. And it is enough for most FBN's RMI design. (But it miss the DataAccessFactory)
- Level 3 add one more layer. It uses a Proxy to delegate the local and remote implementation. It add feasibility to route between local and remote or add more functionality to them. And we have no necessarily to use it.
Am I right?
Actually, I think, this article gives a clear presentation on how to apply RMI factory patterns, comparing with Sun's article. Javaworld's example is simple to learn. It is good to the most of the RMI beginner, like me. Of coz, please remove the proxy.
Cheers,
Leo Tai
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic