Package org.infinispan.persistence.spi
Interface TransactionalCacheWriter<K,V>
- All Superinterfaces:
AdvancedCacheWriter<K,
,V> CacheWriter<K,
,V> Lifecycle
@Deprecated(forRemoval=true)
public interface TransactionalCacheWriter<K,V>
extends AdvancedCacheWriter<K,V>
Deprecated, for removal: This API element is subject to removal in a future version.
Defines the functionality of a transactional store. This interface allows the implementing store to participate in the
2PC protocol of a cache's transaction. This enables the cache transaction to be rolledback if an exception occurs whilst
writing key changes to the underlying store, or for the writes to the underlying store to be rolledback if the exception
occurs in-memory.
As this writer is part of the 2PC, all writes to the underlying store should only be executed by the originator of a
transaction in normal operation. In the event that the originator crashes between the prepare and commit/rollback phase
it is expected that the underlying store's transaction will eventually timeout and rollback. In the event that the originator
crashes and transaction recovery is enabled, then forcing commit will result in the replaying of said Tx's (prepare/commit) to
the underlying store.
- Since:
- 9.0
- Author:
- Ryan Emerson
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.persistence.spi.AdvancedCacheWriter
AdvancedCacheWriter.PurgeListener<K>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commit
(javax.transaction.Transaction transaction) Deprecated, for removal: This API element is subject to removal in a future version.Commit the provided transaction's changes to the underlying store.void
prepareWithModifications
(javax.transaction.Transaction transaction, BatchModification batchModification) Deprecated, for removal: This API element is subject to removal in a future version.Write modifications to the store in the prepare phase, as this is the only way we know the FINAL values of the entries.void
rollback
(javax.transaction.Transaction transaction) Deprecated, for removal: This API element is subject to removal in a future version.Rollback the provided transaction's changes to the underlying store.Methods inherited from interface org.infinispan.persistence.spi.AdvancedCacheWriter
clear, purge
Methods inherited from interface org.infinispan.persistence.spi.CacheWriter
bulkUpdate, delete, deleteBatch, init, isAvailable, write
-
Method Details
-
prepareWithModifications
void prepareWithModifications(javax.transaction.Transaction transaction, BatchModification batchModification) throws PersistenceException Deprecated, for removal: This API element is subject to removal in a future version.Write modifications to the store in the prepare phase, as this is the only way we know the FINAL values of the entries. This is required to handle scenarios where an objects value is changed after the put command has been executed, but before the commit is called on the Tx.- Parameters:
transaction
- the current transactional context.batchModification
- an object containing the write/remove operations required for this transaction.- Throws:
PersistenceException
- if an error occurs when communicating/performing writes on the underlying store.
-
commit
void commit(javax.transaction.Transaction transaction) Deprecated, for removal: This API element is subject to removal in a future version.Commit the provided transaction's changes to the underlying store.- Parameters:
transaction
- the current transactional context.
-
rollback
void rollback(javax.transaction.Transaction transaction) Deprecated, for removal: This API element is subject to removal in a future version.Rollback the provided transaction's changes to the underlying store.- Parameters:
transaction
- the current transactional context.
-
NonBlockingStore