Hi,
Today I ran Roberto's tests with my Data class.
If there is a deadlock, the code will hang forever, right?
In my case, since one
thread tries to create same record again and again and another thread takes a random record number for modification, the
test cases are bound to throw exception. So I simply swallowed them (not completely : I just did printStackTrace) and proceeded with testing.
Worst case scenario in my case was the loop counter as 2000 (since that created 10000 threads, my machine started crying and I stopped increasing counter at 2000).
Below are the results:
1) The code did not hang (due to my poor machine, it took over a minute to complete, but it did finish all the task)
2) Only exceptions thrown were RCNF(record not found) and DPK(duplicate key)
So I guess I can conclude that my DB operations are deadlock free, right?