• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Identifying Client Question - AGAIN

 
Richard Walter
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi fellow coders,
I have a question about Identifying the client.
My understanding is that you can identify a client without changing the signatures of the lock and unlock methods by returning a unique copy of RemoteDatabase to each client.
However, since a client cannot directly create a new remote object, how do you return a new instance of RemoteDatabase so that it is still a remote object. Does RemoteDatabase have to be activatable?
Thanks,
Richard Walter
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about an object bound, that is a factory of connection objects. these connections are your remote objects.
Mark
 
Richard Walter
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:
Think about an object bound, that is a factory of connection objects. these connections are your remote objects.
Mark

I just answer my own question just after posting it(I think?). I didnt know that a remote object (say RemoteConnection) returned by another remote object (say RemoteConnectionFactory) returns a proxy to the remote object. I thought it would serialize RemoteConnection.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is where the Remote interface comes in. RMI will pass every object that is instanceof Remote by reference, not by value (i.e. no seralisation).
This is also why non-remote objects should never be instanceof Remote. This mistake is easy to make when you create the interface that will be implemented by both Data and RemoteData (or whatever you call it).
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic