Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S & Denny's: Design decisions (locking stuff really)

 
Mickey Mulligan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic