simpledb.tx.concurrency
Class ConcurrencyMgr

java.lang.Object
  extended by simpledb.tx.concurrency.ConcurrencyMgr

public class ConcurrencyMgr
extends Object

The concurrency manager for the transaction. Each transaction has its own concurrency manager. The concurrency manager keeps track of which locks the transaction currently has, and interacts with the global lock table as needed.

Author:
Edward Sciore

Constructor Summary
ConcurrencyMgr()
           
 
Method Summary
 void release()
          Releases all locks by asking the lock table to unlock each one.
 void sLock(Block blk)
          Obtains an SLock on the block, if necessary.
 void xLock(Block blk)
          Obtains an XLock on the block, if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrencyMgr

public ConcurrencyMgr()
Method Detail

sLock

public void sLock(Block blk)
Obtains an SLock on the block, if necessary. The method will ask the lock table for an SLock if the transaction currently has no locks on that block.

Parameters:
blk - a reference to the disk block

xLock

public void xLock(Block blk)
Obtains an XLock on the block, if necessary. If the transaction does not have an XLock on that block, then the method first gets an SLock on that block (if necessary), and then upgrades it to an XLock.

Parameters:
blk - a refrence to the disk block

release

public void release()
Releases all locks by asking the lock table to unlock each one.



Copyright © 2011. All Rights Reserved.