reset password
Author Message
HelloWorld
Posts: 88
Posted 09:46 Aug 24, 2009 |

In ConcurrencyMgr: private Map<Block,String> locks  = new HashMap<Block,String>();

In LockTable: private Map<Block,Integer> locks = new HashMap<Block,Integer>();

Since LockTable is static, this value is only 1, and I'm assuming that this Lock is for each Transaction? While in ConcurrencyMgr is Lock for each Item of the Transaction, so for example in Transaction 1, it manages the Lock of the items in Transaction 1, i.e. W1 R1, etc..?

cysun
Posts: 2935
Posted 10:16 Aug 24, 2009 |

I don't quite get your question. Basically LockTable is shared by all transactions, while each transaction has its own ConcurrencyMgr. locks in ConcurrencyMgr simply keeps track of the locks held by one transaction, so that this transaction knows which locks to release later.

HelloWorld
Posts: 88
Posted 11:05 Aug 24, 2009 |
cysun wrote:

I don't quite get your question. Basically LockTable is shared by all transactions, while each transaction has its own ConcurrencyMgr. locks in ConcurrencyMgr simply keeps track of the locks held by one transaction, so that this transaction knows which locks to release later.

I'm just wondering, on what is the difference between the locks within the LockTable class, and the locks within the ConcurrencyMgr class?

cysun
Posts: 2935
Posted 11:15 Aug 24, 2009 |
HelloWorld wrote:
cysun wrote:

I don't quite get your question. Basically LockTable is shared by all transactions, while each transaction has its own ConcurrencyMgr. locks in ConcurrencyMgr simply keeps track of the locks held by one transaction, so that this transaction knows which locks to release later.

I'm just wondering, on what is the difference between the locks within the LockTable class, and the locks within the ConcurrencyMgr class?

A lock is an object, and what stored in those Maps are references to the lock objects. There could be multiple references to the same object. For example, there could be a reference to a lock object in LockTable, and another reference to the same object in ConcurrencyMgr.