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.
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.