• 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

Hand-over-hand locking in SCJD book example

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,
I am a bit confused about the example for the "Multiple Notification Objects" in Andrews book.

This example never removes the dvdLock (per record lock) from the reservations. This means that once the record is reserved it stays in the reservations map together with the database object for ever (even if the lock is released ). There is not problem regarding the locking as every unlock method sets reserver in the dvdLock to null so the record is free for use, but map grows bigger and bigger until its size is equal to the number of records and it never changes until the program is restarted.

I was not able to figure out how and where to identify the situation where dvdLock can be completele removed from the reservations.

Do you have any ideas?

Regards,
Tomas
 
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I did not see this example, just a quick idea, could it be that he's using some WeakHashMap/WeakReferences ?

regards,
Alex
 
Tomas Klubal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Alex Belisle Turcot:
Hi,

I did not see this example, just a quick idea, could it be that he's using some WeakHashMap/WeakReferences ?

regards,
Alex



Well, he does not and I doubt it would help in any way. I have found one thread that describes the same problem in greater detail and without any solution.
B&S: Locking dilema

Rehards,
Tomas
 
reply
    Bookmark Topic Watch Topic
  • New Topic