Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wondering with RMI server!

 
Victor Pan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In RMI server side, I use LockManager to manager multiple access to records in db file. LockManager hold the record number and reference of DBConnection with a HashMap object.
Now, problem arised. If a DBConnection is broken while his reference is holding by HashMap, then no other DBConnection can access the record.
What can I do?
Anyway, I got a opion that unreference the DBConnection Object with Unreferecnce interface.
But after I make the DBConnection implements the interface, when I stop the server, I cannot stop server immediately. How can I stop the server with considering connection breaking....
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Victor Pan:
[...] But after I make the DBConnection implements the [Unreferenced] interface, when I stop the server, I cannot stop server immediately.
Why not? How did you implement the unreferenced() method?
- Peter
 
Victor Pan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the unreferenced method, I put invoke the lockmanager's method to remove the reference of DBConnection itself.
Is it true that if one class implemented Unreferenced interface, then everytime the reference is removed, the method will be executed?
For instance, if there are two variable referenceing one object implemented Unreference, when give null to the two variable, the unreferenced method will be executed twice?
 
Brian Blignaut
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as my understanding goes, the unreferenced method will only be called when all remote references to the object are dropped, not every time a reference is dropped
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spot on Brian.
- Peter
 
Victor Pan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Brian.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic