TrueUpdate Manager Specification 0.7.1

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 prepare() has thrown an exception or perform() has thrown an exception and rollback() has succeeded, then clients will still 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()
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 throws a RuntimeException, then the state of this transaction is undefined and may be inconsistent. If this method throws a RuntimeException and this transaction is part of a composite transaction, then the preceding transactions get neither committed nor rolled back and their state is undefined and may be inconsistent.


perform

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

Throws:
Exception

prepare

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

Throws:
Exception

rollback

public abstract void rollback()
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 throws a RuntimeException, then the state of this transaction is undefined and may be inconsistent. If this method throws a RuntimeException and this transaction is part of a composite transaction, then the preceding transactions get neither committed nor rolled back and their state is undefined and may be inconsistent.


TrueUpdate Manager Specification 0.7.1

Copyright © 2013 Schlichtherle IT Services. All rights reserved.