pt.ist.fenixframework
Interface TransactionManager

Package class diagram package TransactionManager
All Superinterfaces:
TransactionManager

public interface TransactionManager
extends TransactionManager

Fenix Framework's interface for all Transaction Managers. This interface is similar to TransactionManager's interface with some extensions added. Please refer to the documentation in each individual backend for the list of supported operations.

See Also:
javax.transaction

Method Summary
 void addCommitListener(CommitListener listener)
          Registers a commit listener, that will be called whenever any Transaction managed by this Manager is committed.
 void begin(boolean readOnly)
          Create a new transaction and associate it with the current thread.
 Transaction getTransaction()
          Get the Transaction object that represents the transaction context of the calling thread.
 void removeCommitListener(CommitListener listener)
          Unregisters the given commit listener.
<T> T
withTransaction(Callable<T> command)
          Transactionally execute a command, possibly returning a result.
<T> T
withTransaction(Callable<T> command, Atomic atomic)
          Transactionally execute a command, possibly returning a result.
<T> T
withTransaction(CallableWithoutException<T> command)
          Transactionally execute a command, possibly returning a result.
 
Methods inherited from interface javax.transaction.TransactionManager
begin, commit, getStatus, resume, rollback, setRollbackOnly, setTransactionTimeout, suspend
 

Method Detail

getTransaction

Transaction getTransaction()
Get the Transaction object that represents the transaction context of the calling thread. Subsequent calls to this method, while in the scope of a given transaction, will always return the same instance.

Specified by:
getTransaction in interface TransactionManager

withTransaction

<T> T withTransaction(CallableWithoutException<T> command)
Transactionally execute a command, possibly returning a result. Implementations of this method normally invoke #withTransaction(Callable, Atomic) with a default atomic behaviour.

Parameters:
command - The command to execute.

withTransaction

<T> T withTransaction(Callable<T> command)
                  throws Exception
Transactionally execute a command, possibly returning a result. Implementations of this method normally invoke #withTransaction(Callable, Atomic) with a default atomic behaviour.

Parameters:
command - The command to execute.
Throws:
Exception

withTransaction

<T> T withTransaction(Callable<T> command,
                      Atomic atomic)
                  throws Exception
Transactionally execute a command, possibly returning a result.

Parameters:
command - The command to execute
atomic - the configuration for the execution of this command.
Throws:
Exception

begin

void begin(boolean readOnly)
           throws NotSupportedException,
                  SystemException
Create a new transaction and associate it with the current thread. This method can be used as a hint from the programmer that she does (or does not) intend do perform write operations. As such, implementations may optimize for the read-only case, and fail as soon as a write is attempted. However, if during the transaction the program attempts any write, and the transactional system is able to cope with the request, it may proceed without failing. In other words, write transactions are not guaranteed to rollback (i.e. they may commit) when invoking this method with true.

Throws:
NotSupportedException - Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions.
SystemException - Thrown if the transaction manager encounters an unexpected error condition that prevents future transaction services from proceeding.

addCommitListener

void addCommitListener(CommitListener listener)
Registers a commit listener, that will be called whenever any Transaction managed by this Manager is committed.

Parameters:
listener - The listener to be added.
Throws:
NullPointerException - If the listener is null.

removeCommitListener

void removeCommitListener(CommitListener listener)
Unregisters the given commit listener.

Parameters:
listener - The listener to be removed.


Copyright © 2013. All Rights Reserved.