TrueUpdate Manager Specification 0.2

net.java.trueupdate.manager.spec.tx
Class Transaction

java.lang.Object
  extended by net.java.trueupdate.manager.spec.tx.Transaction
Direct Known Subclasses:
AtomicMethodsTransaction, CompositeTransaction

public abstract class Transaction
extends Object

A simple interface for local transactions. The use case is to compose file system operations with ACID properties into larger transactions, for example for undeploying, updating and deploying an enterprise application to an application server.

Note that transactions are generally not idempotent, that is once their execution has succeeded, you may not be able to execute them successfully again because the preconditions for a successful execution are no longer met. However, transactions must be retryable, that is if their execution has failed with any other exception than a TransactionException, then you will be able to execute them successfully as soon as the preconditions for a successful execution are met.

Author:
Christian Schlichtherle
See Also:
Transactions.execute(net.java.trueupdate.manager.spec.tx.Transaction), CompositeTransaction

Constructor Summary
Transaction()
           
 
Method Summary
 void commit()
          Commits the visible side effects of the body of this transaction.
abstract  void perform()
          Executes the body of this transaction.
 void prepare()
          Sets up this transaction for execution.
abstract  void rollback()
          Reverts any visible side effects of the body of this transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction()
Method Detail

commit

public void commit()
            throws Exception
Commits the visible side effects of the body of this transaction. If this method succeeds, any visible side effects of perform() must be durable. If this method fails, the state of this transaction is undefined and may be inconsistent. If this method fails and this transaction is part of a composite transaction, then the previous transactions get neither committed nor rolled back and their state is undefined and may be inconsistent.

Throws:
Exception

perform

public abstract void perform()
                      throws Exception
Executes the body of this transaction. If this method fails then this transaction gets aborted with calling rollback(), so it may leave some visible side effects. If this method fails and this transaction is part of a composite transaction, then the previous transactions get properly rolled back.

Throws:
Exception

prepare

public void prepare()
             throws Exception
Sets up this transaction for execution. If this method fails then this transaction gets aborted without calling rollback(), so it must not leave any visible side effects. If this method fails and this transaction is part of a composite transaction, then the previous transactions get properly rolled back.

Throws:
Exception

rollback

public abstract void rollback()
                       throws Exception
Reverts any visible side effects of the body of this transaction. If this method succeeds, it must revert any visible side effects of perform(). If this method fails, the state of this transaction is undefined and may be inconsistent. If this method fails and this transaction is part of a composite transaction, then the previous transactions get neither committed nor rolled back and their state is undefined and may be inconsistent.

Throws:
Exception

TrueUpdate Manager Specification 0.2

Copyright © 2013 Schlichtherle IT Services. All rights reserved.