This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hello. I'me starting to make some tests so that I can test the server and the reservation mechanism. I have the lock manager as follows:
As i've used a factory, i get a diferent client number, so here i don't have any problem The main problem for now is that i've build a small test program that makes seat reservation in one flight. The program is as follows:
And the code to make the seat reservation:
The big problem is when i run the test program with this 5 clients, it only reserves 2 seats After the lock and unlock method in the server i've put a print to show the result, and the problem cames here. The output in the server is as follows:
I'm with all this. Where is the problem? Thanks for your help. Miguel
First is a little thing. You do not need the break; lines in the LockManager. Second, it appears that there are no exceptions being thrown, else you would have ahd a stack trace. So that means you need to debug your booking method, as you don't show your test thread code. The way I like to debug is longer winded than some tools that are out there, but I use the old "System.out.println("I am here in the code");" Then you can see how far the code gets. If you are using 1.4 then you can add assertions to your code to make sure that the data/variables are set to where you would expect them to be. Sorry I couldn't be of more help to you, but sometimes debugging is the best learning tool, and I wouldn't want to lose that great tool. Mark
Hello. Just seen the error ! I was using the data from the find method to make the reservation . I was not following the Lock->Read->Modify->Unlock . By the way. I like to use the tipical debug System.out.println("Here I am"); i'ts the best debug tool that I know . Thanks for the help. Miguel