Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Was the lock successful?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
poornima.
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic