Hi Pratibha
OK, If you are using RMI, then
you should not be using the thread as your client identifier, as you have no gurarantees what thread will be used.
From the
RMI Specifications:
A method dispatched by the RMI runtime to a remote object implementation may or may not execute in a separate thread. The RMI runtime makes no guarantees with respect to mapping remote object invocations to threads.
In other words, the following is possible:
client A calls method1 --> executes in thread 1client A calls method2 --> executes in thread 2client B calls method1 --> executes in thread 2client B calls method2 --> executes in thread 5 Data.lock() only takes an integer as a parameter. You cannot pass the thread name as a parameter. So how are you getting the thread name in to your Hashtable? Do you have multiple instances of the Data class?
I think you are saying that your method bookSeats() is running on the server. Is this correct?
So this means that a remote client (not one you wrote) could call bookSeats(). Alternatively it could call lock(), read(), modify(), and unlock(). Is this correct?
I think I had better stop posting. I might scare you away with all my questions
Regards, Andrew