• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to know the client's info invoking a remote method via RMI?

 
tonny slm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who can tell me how to get the client's information, such as ip, host name while he or she is invoking a remote method via the RMI? Thank you!
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this have anything to do with identifying a client for locking/unlocking?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Tonny,
You can call getClientHost() which is inherited from RemoteServer (which is the superclass of both Activatable and UnicastRemoteObject). But I'm like BJ, does this have to do with mapping clients to record locks? There is a much easier and absolutely guaranteed way of doing that. Use OO methodology. Remember that one of the concepts of Object Orientation is "Object Identity". If you use a connection factory for client connections (which you should) then each client is already uniquely identified. So to map record locks to clients, all you have to do is pass "this" in to your lock manager.
Hope this helps,
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic