[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Locking objects



Hi,
 
I'm now trying to put locks on objects using DefaultLock class.
First, is it the right classe to use ?
 
Then, I want to see what happens when 2 transactions want to lock the same object with LEVEL_WRITE or LEVEL_UPGRADE.
(I suppose it's impossible, perhaps I'm wrong....)
I create 2 threads, first one access and locks the object for 10 seconds while the second one try to access and lock the same object.
I don't understand why I can't succeed, the second one can obtain the lock even if another transaction has already locked the object.
 
If anyone can explain me how to put explicitly locks or show me some code.....
 
thanks.
 
alain