K - Type of keys.V - Type of values.public interface TransactionalMap<K,V> extends Map<K,V>
Map that allows transactional operations. The Map should replay all modifications
during commiting the transaction. In case the implementations wraps another Map, the following
rules should be applied on the replay mechanism:
Map.clear() was called within the transaction, the same method should be replayed in
the beginning of the commitMap.clear() was not called within the transaction,
Map.remove(Object) functions should be replayed for all keys even if that key was not in the
original Map when the Map.remove(Object) was called or a new entry was inserted with
the same key later. In other words, if a key was removed then reinserted, the TransactionalMap
implementation should replay the remove and the last put method on the wrapped Map. This can be
important for invalidation caches where calling the remove function generates a synchronization
between nodes in a cluster.| Modifier and Type | Method and Description |
|---|---|
void |
commitTransaction()
Commits the currently associated transaction.
|
Object |
getAssociatedTransaction()
Gives back the currently associated transaction.
|
void |
resumeTransaction(Object transaction)
Resumes a previously suspended transaction.
|
void |
rollbackTransaction()
Calls a rollback on the currently associated transaction.
|
void |
startTransaction(Object transaction)
Starts a new transaction on the
TransactionalMap. |
void |
suspendTransaction()
Suspends the currently associated transaction.
|
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesvoid commitTransaction()
IllegalStateException - if no transaction is associated currently to the TransactionalMap.Object getAssociatedTransaction()
null if no transaction is
associated at the moment.void resumeTransaction(Object transaction)
transaction - The previously suspended transaction.IllegalStateException - if the provided transaction is not in suspended state or there is another active
associated transaction.void rollbackTransaction()
IllegalStateException - if no transaction is associated currently to the TransactionalMap.void startTransaction(Object transaction)
TransactionalMap.transaction - The transaction that will be associated to the TransactionalMap.IllegalStateException - if the TransactionalMap is already associated to the provided transaction
(either in suspended or active state) or other transaction is currently associated to
the TransactionalMap in active state.void suspendTransaction()
IllegalStateException - if no transaction is associated currently to the TransactionalMap.Copyright © 2011–2015 Everit Kft.. All rights reserved.