org.apache.commons.transaction
Interface TransactionalResourceManager

All Known Subinterfaces:
ManageableResourceManager, TxMap<K,V>
All Known Implementing Classes:
AbstractTransactionalResourceManager, BasicTxMap, OptimisticTxMap, PessimisticTxMap, TxFileResourceManager

public interface TransactionalResourceManager

Interface for something that makes up a transactional resource manager. Used for user control. Comparable to an XA resource.


Method Summary
 boolean commitTransaction()
          Commits all changes made in the current transaction and deletes the association between the current thread and the transaction.
 void rollbackTransaction()
          Discards all changes made in the current transaction and deletes the association between the current thread and the transaction.
 void startTransaction(long timeout, TimeUnit unit)
          Starts a new transaction and associates it with the current thread.
 

Method Detail

startTransaction

void startTransaction(long timeout,
                      TimeUnit unit)
Starts a new transaction and associates it with the current thread. All subsequent changes in the same thread made to the resource manager are invisible from other threads until commitTransaction() is called. Use rollbackTransaction() to discard your changes. After calling either method there will be no transaction associated to the current thread any longer.

Caution: Be careful to finally call one of those methods, as otherwise the transaction will lurk around for ever.

See Also:
commitTransaction(), rollbackTransaction()

rollbackTransaction

void rollbackTransaction()
Discards all changes made in the current transaction and deletes the association between the current thread and the transaction.

See Also:
startTransaction(long, TimeUnit), commitTransaction()

commitTransaction

boolean commitTransaction()
Commits all changes made in the current transaction and deletes the association between the current thread and the transaction.

See Also:
startTransaction(long, TimeUnit), rollbackTransaction()


Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.