Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Was the lock successful?

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a screen which displays the JTable showing all the flight records selected by the user.Now when the user selects a flight,I lock the record, & take him to the reservation screen where the user selects the number of seats to be booked.
My question is I do not want to take the user to the reservation screen until the I lock the record successfully.( which means that the record is in my HashMap ).
At present in lock method, if the record is already present in the HashMap,the thread simply goes to the wait state.
My only concern is I do not want to show him the number of seats to be booked until I am sure that his record is being locked.
Please reply,
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion it is a bad idea to hold a lock while the user is deciding if they want to book a flight. What if they go to lunch and forget?
I think that a lock should be held for as short a time as possible. If it were not for the Sun requirements, it would be even better to provide a BookFlight() method in the server interface so the client never does the lock.
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic