• 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

Question on lock()/unlock()

 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
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!
Don
 
reply
    Bookmark Topic Watch Topic
  • New Topic