org.apache.commons.transaction.memory
Interface TxMap<K,V>

All Superinterfaces:
ManageableResourceManager, Map<K,V>, TransactionalResourceManager
All Known Implementing Classes:
BasicTxMap, OptimisticTxMap, PessimisticTxMap

public interface TxMap<K,V>
extends Map<K,V>, ManageableResourceManager

Interface for a map that features transactional support.

Start a transaction by calling TransactionalResourceManager.startTransaction(long, java.util.concurrent.TimeUnit). Then perform the normal actions on the map and finally either call TransactionalResourceManager.commitTransaction() to make your changes permanent or TransactionalResourceManager.rollbackTransaction() to undo them.

Caution: Do not modify values retrieved by Map.get(Object) as this will circumvent the transactional mechanism. Rather clone the value or copy it in a way you see fit and store it back using Map.put(Object, Object).

See Also:
BasicTxMap, OptimisticTxMap, PessimisticTxMap

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 Map<K,V> getWrappedMap()
          Gets the underlying map that is wrapped by this transactional implementation.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface org.apache.commons.transaction.ManageableResourceManager
commitCanFail, forgetTransaction, isReadOnly, isRollbackOnly, joinTransaction, prepareTransaction
 
Methods inherited from interface org.apache.commons.transaction.TransactionalResourceManager
commitTransaction, rollbackTransaction, startTransaction
 

Method Detail

getWrappedMap

Map<K,V> getWrappedMap()
Gets the underlying map that is wrapped by this transactional implementation.

Returns:
the wrapped map


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