Before my booking method uses only one single
thread, so when the database is locked up, any attempt to lock a record will have to wait forever, and eventually the application got frozen until someone removes the lock.
So I create a new thread for each book request. when i
test it
i use a for loop as follows
for (int i=0; i < 30; i++) {
BookingThread thread = new BookingThread(some parameters...);
thread.start();
}
So eventually i booked the same record 30 times. I have 2 client booking the same record, so if i booked 1 ticket, the total should went down by 60 tickets. Both client has been successfully booked some records, but after somewhere around 20-30 tickets being booked, i receive an error message of :
Connection refused to Host: 216.XxX.XXX.XX; nested exception is: java.net.ConnectException: Connection Refused: No further information
Any one know what this mean ?
is it a limitation on total number of threads accessing RMI ?
Or is it the problem with my testing approach ?
Or is it purely my lock mechanism problem.
My lock mechanism works when booking is implemented in one single thread, even when more than 6 client is accessing the same record. It is just that the application will hang for a while until it sucessfully lock a record (2-3 seconds). But like i say, if someone lock the entire database and not unlocking, the program will hang forever
Thanks in advance
Karl