Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Question on lock()/unlock()

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!
Whatever. Here's a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic