de.tubs.macs.util.transaction
Class WaitingTable

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

class WaitingTable
extends java.lang.Thread

Waiting-Table for TransactionSystem.

Implementation of a special Waiting-table for the TransactionSystem.

Author:
Oliver Eggers

Field Summary
(package private) static java.lang.String THREAD_NAME
          Name of the WaitingTable Thread.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, values
 
Constructor Summary
(package private) WaitingTable(TransactionSystem ts)
          Instantiates a new Waiting-Table for use with the TransactionSystem.
 
Method Summary
(package private)  void add(Transaction ta)
          Adds a Transaction to the Waiting-table.
(package private)  Transaction get(java.lang.Long seq)
          Retrieves a Transaction out of the Waiting-table.
(package private)  java.lang.Object[] getAll()
          Returns all waiting/sleeping Transactions.
(package private)  void remove(java.lang.Long seq)
          Removes a Transaction from the Waiting-table.
 void run()
          Implementation of run();-method for Waiting-Table-Thread.
(package private)  int size()
          Returns the number of Transactions in the Waiting-Table.
(package private)  void trigger()
          Notifies waiting table to look for queueable Transactions again.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

THREAD_NAME

static final java.lang.String THREAD_NAME
Name of the WaitingTable Thread.
Constructor Detail

WaitingTable

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

add

void add(Transaction ta)
Adds a Transaction to the Waiting-table. If the Transaction is sleeping it will push a the trigger, when the sleep time is over.
Parameters:
ta - The Transaction, that has to wait or sleep.

remove

void remove(java.lang.Long seq)
Removes a Transaction from the Waiting-table.
Parameters:
seq - Sequence-nr. of Transaction to remove from Waiting-table.

get

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

getAll

java.lang.Object[] getAll()
Returns all waiting/sleeping Transactions.

size

int size()
Returns the number of Transactions in the Waiting-Table.

trigger

void trigger()
Notifies waiting table to look for queueable Transactions again. All Transactions with `wakeUpTime' less or equal `current session-time' will be enqueued again.

run

public void run()
Implementation of run();-method for Waiting-Table-Thread.
Overrides:
run in class java.lang.Thread