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

Hand-over-hand locking in SCJD book example

 
Tomas Klubal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic