• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unreferenced Interface,

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,
Do we need to implemet Unreferenced interface for our remote object? and why?
Thanks in advance
Sam
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sam,
Well it depends on whether or not and how you plan to deal with stale clients. Read through (you can actually skip most of it and do a search from your browser for unreferenced) this post and you decide if you need to implement it:
Long Thread on Locking
Hope this helps,
Michael Morris
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael,
The way I did clean the dead client is different.

I create a nested class inside of LockManager to hold objectID, recordNum and the time it received the lock and I have Vector to store or remove that kind of object during lock and unlock, I also create a daemon thread running every 2 second and check if there is any expired object is in Vector then it will clean the dead client and unlock that record too.
how do you feel about it ? is that the right design
Regards
Sam
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sam,
It's OK to do it that way, I know that many have taken a similar approach. A couple of points though:
  • Implementing Unreferenced is a no-brainer
  • Using a roll-your-own timeout assumes something that may not be true, ie the client may just be taking its own sweet time


  • But I don't think you'll lose any points for dealing with stale clients in this manner.
    Hope this helps,
    Michael Morris
     
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sam, I'd suggest you use ArrayList instead of Vector.
    Vector and HashTable is considered the old collections, whereas ArrayList and HashSet are par tof the newer collections objects, the are more light-weight than the older versions.
    Mark
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic