... Every time when client clicks the book seat button,a thread is created.
multiple book seat function at a time for one client
If it is successful,the seat number JTextField will show the remained seat nubmers.
If a client book different flight at a time,it is very difficult to showback the information.Maybe only need to show a message box,but I think it is not friendly,do you think so?
And do you have any suggestions?
I just updated the number of seats in the JTable and popped up a dialog to notify the user that the booking had completed sucessfully or failed.
Also, my booking panel kept a set of pending bookings so that if a booking took a long time and the user reselected that record then booking would be disabled.
I am looking for a way to refresh the JTable living,maybe you can tell me it clearly.
It is necessary to deal with the booking atcion that had taken a long time,but how do you deal this situation: clinet create Thread A to book a flight and something forced the client to wait,but when the thread was just modifyed the flight and did not unlock it,the time of the Thread A is over,what should to do?
In that case, a RemoteException should be thrown on the call to unlock(). In my implementation, notifyObservers() was called with a value of BOOK_UNLOCK_ERROR. This was considered a warning and not an error since presumably modify() had already been called. I just assumed that the booking was successful and popped up a warning dialog to the user that also stated that the booking had completed.
But my DataFacade class donot know this situation (just modified but not unlock record)on server side at all, ...
I want to define the subthread that want to book flghts only can run a fix times,
if the time is over,the booking thread will be interrupted.
Could you tell me some details?
You can then define an inner class the extends java.util.TimerTask which can interrupt the booking operating upon firing.
First off, you may be better off not putting the timer and timer task in the same class as the booking thread.
So when your timer fires, it could call timedOut() one the booking thread and notfiy the client that the booking operation timed out.
The problem here is that on a dead connection,the Socket is blocking and will continue to do so until an IOException is thrown.