com.marringtons.object
Class Transaction

java.lang.Object
  extended bycom.marringtons.object.Transaction

public class Transaction
extends Object

The Adept database includes a session based transaction wrapper for combining database updates so that they can all be committed or discarded together. Call start() and all database commits will be held and deferred until an end() or abort(). Transactions can be nested. The infrastructure will call endAll() at the end of a response to the UI to make sure there are no outstanding transactions while waiting for user input. The infrastructure also catches any unchecked exceptions and aborts any outstanding transactions. In practice this means that code can call Transaction.start() to start a transaction set, then forget all about it knowing the the transaction will be committed or aborted at the correct time.

Author:
Paul Marrington

Constructor Summary
Transaction()
           
 
Method Summary
static void abort()
          Abort a transaction - discarding outstanding changes.
static void abortAll()
          End all outstanding transactions in the nest.
static void end()
          Finalise a transaction - committing outstanding changes.
static void endAll()
          End all outstanding transactions in the nest.
static boolean isActive()
          Called by the infrastructure to make sure there are no active transactions at a point where all logic should be complete - as in the end of a web transaction.
static void start()
          Start a new Transaction.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction()
Method Detail

start

public static void start()
Start a new Transaction. Transactions are nested. This will increase the depth of the nest.


end

public static void end()
Finalise a transaction - committing outstanding changes. It may be optional in a controlled infrastructure when the transaction is finalised as part of the conversation.


endAll

public static void endAll()
End all outstanding transactions in the nest. Called by the infrastructure to make sure all transactions are completed and DAOs committed once the processing is complete and a response sent to the server.


abort

public static void abort()
Abort a transaction - discarding outstanding changes. Any unchecked exceptions in the infrastructure will call this rather than end().


abortAll

public static void abortAll()
End all outstanding transactions in the nest. Any unchecked exceptions in the infrastructure will call this rather than endAll().


isActive

public static boolean isActive()
Called by the infrastructure to make sure there are no active transactions at a point where all logic should be complete - as in the end of a web transaction.

Returns:
true if there are outstanding transactions that have not had end() or abort() called.


Copyright © 2005 Paul Marrington http://library.marringtons.com