de.tubs.macs.util.transaction
Class RunningTable

java.lang.Object
  |
  +--de.tubs.macs.util.transaction.RunningTable

class RunningTable
extends java.lang.Object

Running-Table.

Implementation of a special Running-Table for the Transaction-System. This table contains all Transactions, that are currently running/active in this TransactionSystem.

Author:
Oliver Eggers - IBR Technical University Braunschweig
WWW: http://www.cs.tu-bs.de/~eggers

Constructor Summary
(package private) RunningTable(TransactionSystem ts)
          Instantiates a new Running-Table for use with the TransactionSystem.
 
Method Summary
(package private)  void add(Transaction ta)
          Adds a Transaction to the Running-Table.
 boolean anyRunning()
          Checks if any transaction is running
(package private)  Transaction get(java.lang.Long seq)
          Retrieves a Transaction out of the Running-Table.
(package private)  java.lang.Object[] getAll()
          Returns all running Transactions.
(package private)  boolean groupRunning(java.lang.String group)
          Checks whether a Transaction of the given group is running in the TransactionSystem.
(package private)  boolean nameRunning(java.lang.String taName)
          Checks whether a Transaction of the given name is running in the TransactionSystem.
 int numRunning()
          Returns the number of Transactions, that are currently in the RunningTable.
 int numRunning(java.lang.String taName)
          Returns the number of Transactions with a special name, that are currently in the Running-Table.
(package private)  void remove(java.lang.Long seq)
          Removes a Transaction from the Running-Table by sequence.
(package private)  void remove(Transaction ta)
          Removes a Transaction from the Running-Table by class (calls removal by sequence).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunningTable

RunningTable(TransactionSystem ts)
Instantiates a new Running-Table for use with the TransactionSystem. These classes are strictly connected!
Parameters:
ts - Reference to the TransactionSystem this Running-Table is used for.
Method Detail

add

void add(Transaction ta)
Adds a Transaction to the Running-Table. If the Transaction is sleeping it will be woke up (`Transaction.transactionResume();'), if it is idle it will be started (`Transaction.transactionStart();').
Parameters:
ta - The Transaction, that has to wait or sleep.

remove

void remove(Transaction ta)
Removes a Transaction from the Running-Table by class (calls removal by sequence).
Parameters:
ta - The Transaction to be removed.

remove

void remove(java.lang.Long seq)
Removes a Transaction from the Running-Table by sequence.
Parameters:
seq - Sequence-number of Transaction to be removed.

get

Transaction get(java.lang.Long seq)
Retrieves a Transaction out of the Running-Table.
Parameters:
seq - Sequence-nr. of the Transaction.

getAll

java.lang.Object[] getAll()
Returns all running Transactions.

anyRunning

public boolean anyRunning()
Checks if any transaction is running

numRunning

public int numRunning()
Returns the number of Transactions, that are currently in the RunningTable.

numRunning

public int numRunning(java.lang.String taName)
Returns the number of Transactions with a special name, that are currently in the Running-Table.
Parameters:
taName - Name of Transactions to count.

nameRunning

boolean nameRunning(java.lang.String taName)
Checks whether a Transaction of the given name is running in the TransactionSystem.
Parameters:
taName - Transaction classname to be checked.

groupRunning

boolean groupRunning(java.lang.String group)
Checks whether a Transaction of the given group is running in the TransactionSystem.
Parameters:
group - Transaction group-name to be checked.