harpoon.Runtime.Transactions
Class CommitRecord

java.lang.Object
  extended by harpoon.Runtime.Transactions.CommitRecord

public class CommitRecord
extends Object

A CommitRecord keeps track of the status of a transaction. It is initialized in the WAITING state and can be updated exactly once to either COMMITTED or ABORTED. Transactions can be nested; therefore CommitRecords can be dependent on other commit records.

Version:
$Id: CommitRecord.java,v 1.3 2003/07/21 21:21:58 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Field Summary
static int ABORTED
           
static int COMMITTED
           
 CommitRecord parent
          The commit record that this is dependent on, if any.
static int WAITING
           
 
Method Summary
 int abort()
          Abort this (sub)transaction, if possible.
static int abort(CommitRecord c)
          Abort a transaction, if possible.
 int commit()
          Commit this (sub)transaction, if possible.
static int commit(CommitRecord c)
          Commit a transaction, if possible.
 void commitTransaction()
           
static CommitRecord newTransaction(CommitRecord parent)
          Constructor method.
 CommitRecord retryTransaction()
          Returns a new commit record suitable for retrying this transaction.
 int state()
          Returns the 'state' of this record (including dependencies)
static int state(CommitRecord c)
          'StateP' procedure from write-up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAITING

public static final int WAITING
See Also:
Constant Field Values

COMMITTED

public static final int COMMITTED
See Also:
Constant Field Values

ABORTED

public static final int ABORTED
See Also:
Constant Field Values

parent

public final CommitRecord parent
The commit record that this is dependent on, if any.

Method Detail

newTransaction

public static CommitRecord newTransaction(CommitRecord parent)
Constructor method.


retryTransaction

public final CommitRecord retryTransaction()
                                    throws TransactionAbortException
Returns a new commit record suitable for retrying this transaction.

Throws:
TransactionAbortException - if this transaction has been retried too many times.

commitTransaction

public final void commitTransaction()
                             throws TransactionAbortException
Throws:
TransactionAbortException

state

public int state()
Returns the 'state' of this record (including dependencies)


state

public static int state(CommitRecord c)
'StateP' procedure from write-up.


abort

public int abort()
Abort this (sub)transaction, if possible.

Returns:
the final state of the (sub)transaction.

commit

public int commit()
Commit this (sub)transaction, if possible.

Returns:
the final state of the (sub)transaction.

abort

public static int abort(CommitRecord c)
Abort a transaction, if possible.

Returns:
the final state of the (sub)transaction.

commit

public static int commit(CommitRecord c)
Commit a transaction, if possible.

Returns:
the final state of the (sub)transaction.