• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is this Client ID correct?

 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Client connects to RMI server and get the Remote object (obj).
This (obj) connects to a method in implementation class to return (new Implementation()) which is considered the Client ID.
When I run to Dos Windows (it means 2 Clients) and print the (new Implementation()) object, the message below shown:
Get Client ID: HelloServerImpl_Stub[RemoteStub [ref: [endpoint:[203.79.98.192:3141](remote),objID:[1ad086a:f336dba45f:-8000, 2]]]]
The message for the other Client is:
Get Client ID: HelloServerImpl_Stub[RemoteStub [ref: [endpoint:[203.79.98.192:3141](remote),objID:[1ad086a:f336dba45f:-8000, 4]]]]
You can notice the difference only in number 2 and number 4
Is that mean it is really different reference and then can be used as a Client ID???
Cheers
 
Brian Blignaut
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your client connect to a remote factory that then creates a unique object for each connection request? If so then yes this can be used as the client id.
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my Client connects to abstract ConnectionFactory class which return either (new NetworkConnection()) or (new LocalConnection()).
(new NetworkConnection()) has Naming.lookup() service which connects to RMI server and then return the Remote object (obj).
(obj) calls getClientID() in Implementation class and return (new Implementation()) object.
(new Implementation()) is the Client ID.
Isn't it???
thanks
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is this correct???
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Qusay, that sounds right. Your network version gets the object that is in the registry, and calls a method on it to return a Remote Implementation object. This is the cient id you are looking for.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic