concurrency
Class ConcurrencyManager

java.lang.Object
  extended byconcurrency.ConcurrencyManager

public class ConcurrencyManager
extends java.lang.Object

This class controls the concurrent access to the objects of a semiestructured database.


Constructor Summary
ConcurrencyManager(long nextTransactionNumber)
          Constructs a new Concurrency Manager with a initial number of transaction.
 
Method Summary
 void endTransaction(Transaction transaction)
          Removes a transaction from the concurrency manager.
 void lock(Transaction transaction, LockableObject obj, LockMode lockmode)
          Locks a database object.
 void lock(Transaction transaction, LockableObject obj, LockMode lockmode, long timeOut)
          Locks a database object with a specified time out.
 void lockContent(Transaction transaction, DbStorage.PhysicalID id, LockMode lockmode)
          Locks the content of a datum.
 void lockContent(Transaction transaction, DbStorage.PhysicalID id, LockMode lockmode, long timeOut)
          Locks the content of a datum with a specified time out.
 void lockDictionary(Transaction transaction, LockMode lockmode)
          Locks the dictionary.
 void lockDictionary(Transaction transaction, LockMode lockmode, long timeOut)
          Locks the dictionary with a specified time out.
 void lockView(Transaction transaction, DbStorage.PhysicalID id, LockMode lockmode)
          Locks the view of a datum.
 void lockView(Transaction transaction, DbStorage.PhysicalID id, LockMode lockmode, long timeOut)
          Locks the view of a datum with a specified time out.
 Transaction newTransaction()
          Creates and registres a new transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrencyManager

public ConcurrencyManager(long nextTransactionNumber)
Constructs a new Concurrency Manager with a initial number of transaction.

Parameters:
nextTransactionNumber - The next number of transaction.
Method Detail

newTransaction

public Transaction newTransaction()
Creates and registres a new transaction.

Returns:
A Transaction object that represents the new transaction.

endTransaction

public void endTransaction(Transaction transaction)
Removes a transaction from the concurrency manager.

Parameters:
transaction - The transaction to remove.

lock

public void lock(Transaction transaction,
                 LockableObject obj,
                 LockMode lockmode)
          throws NotActiveTransactionException,
                 java.lang.InterruptedException
Locks a database object.

Parameters:
transaction - The transaction that locks.
obj - The object to lock.
lockmode - The locking mode.
Throws:
NotActiveTransactionException
java.lang.InterruptedException

lock

public void lock(Transaction transaction,
                 LockableObject obj,
                 LockMode lockmode,
                 long timeOut)
          throws NotActiveTransactionException,
                 TimeOutException,
                 java.lang.InterruptedException
Locks a database object with a specified time out.

Parameters:
transaction - The transaction that locks.
obj - The object to lock.
lockmode - The locking mode.
timeOut - The time out.
Throws:
NotActiveTransactionException
TimeOutException
java.lang.InterruptedException

lockView

public void lockView(Transaction transaction,
                     DbStorage.PhysicalID id,
                     LockMode lockmode)
              throws NotActiveTransactionException,
                     java.lang.InterruptedException
Locks the view of a datum.

Parameters:
transaction - The transaction that locks.
id - The datum wich view will be locked.
lockmode - The locking mode.
Throws:
NotActiveTransactionException
java.lang.InterruptedException

lockView

public void lockView(Transaction transaction,
                     DbStorage.PhysicalID id,
                     LockMode lockmode,
                     long timeOut)
              throws NotActiveTransactionException,
                     TimeOutException,
                     java.lang.InterruptedException
Locks the view of a datum with a specified time out.

Parameters:
transaction - The transaction that locks.
id - The datum wich view will be locked.
lockmode - The locking mode.
timeOut - The time out.
Throws:
NotActiveTransactionException
TimeOutException
java.lang.InterruptedException

lockContent

public void lockContent(Transaction transaction,
                        DbStorage.PhysicalID id,
                        LockMode lockmode)
                 throws NotActiveTransactionException,
                        java.lang.InterruptedException
Locks the content of a datum.

Parameters:
transaction - The transaction that locks.
id - The datum wich content will be locked.
lockmode - The locking mode.
Throws:
NotActiveTransactionException
java.lang.InterruptedException

lockContent

public void lockContent(Transaction transaction,
                        DbStorage.PhysicalID id,
                        LockMode lockmode,
                        long timeOut)
                 throws NotActiveTransactionException,
                        TimeOutException,
                        java.lang.InterruptedException
Locks the content of a datum with a specified time out.

Parameters:
transaction - The transaction that locks.
id - The datum wich content will be locked.
lockmode - The locking mode.
timeOut - The time out.
Throws:
NotActiveTransactionException
TimeOutException
java.lang.InterruptedException

lockDictionary

public void lockDictionary(Transaction transaction,
                           LockMode lockmode)
                    throws NotActiveTransactionException,
                           java.lang.InterruptedException
Locks the dictionary.

Parameters:
transaction - The transaction that locks.
lockmode - The locking mode.
Throws:
NotActiveTransactionException
java.lang.InterruptedException

lockDictionary

public void lockDictionary(Transaction transaction,
                           LockMode lockmode,
                           long timeOut)
                    throws NotActiveTransactionException,
                           TimeOutException,
                           java.lang.InterruptedException
Locks the dictionary with a specified time out.

Parameters:
transaction - The transaction that locks.
lockmode - The locking mode.
timeOut - The time out.
Throws:
NotActiveTransactionException
TimeOutException
java.lang.InterruptedException