• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question on lock()/unlock()  RSS feed

John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a little confused about lock/unlock methods. Because the assignment already provide modify() and delete() methods, and they are synchronized. Acoording to Sun assignment, when user want to book flight, the only requirement is the seat number get deducted.
So what if for booking flight purpose, I just overload the modify() method, supply the same record but deducted seat number. Since these methods are already thread safe for the same Data object. So what is the need for lock()/unlock()?
Could anyone provide a scenario on how lock/unlock work?
Thanks in advance!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!