Author | Message |
---|---|
cysun
Posts: 2935
|
Posted 15:38 Aug 27, 2009 |
SimpleDB's locking implementation is a bit weird as the condition checks are done in two different classes, but after reading the code more carefully I think it does work. Here's the slock() and xlock() methods in ConcurrentMgr, and these are the methods called by a transaction: public void sLock( Block blk ) public void xLock( Block blk ) Notice that
Now here are slock() and xlock() methods in LockTable, and these methods are called by the slock()/xlock() method in ConcurrentMgr: public synchronized void sLock( Block blk ) synchronized void xLock( Block blk ) The unusual thing is that xlock() only checks whether there are other shared locks, but not other exclusive lock, and this is because the transaction must already hold a shared lock on the block (remember it's done in ConcurrentMgr's xlock()).
Last edited by cysun at
15:38 Aug 27, 2009.
|