Hey, I've seen how logical locking was implemented in Denny's DVD's, the project that came with the SCJD book. I'm looking to do something similar for my assignment (Bodgitt & Scarper), so I'll have a "LockingManager" class to handle locking and unlocking records. At the moment I've got (pseudocode):
I presume using a synchronized block to sort out the problem with threads slicing in is a good idea? Are there any other designs I should look at perhaps? I like the idea of keeping the locking seperate from File I/O so I want to keep it that way. But not if I'm going to lose marks for overuse of 'synchronized'!