Product Documentation : Ehcache Developer Guide : Transaction Support : Transactions in Write-Behind and Write-Through Caches
Transactions in Write-Behind and Write-Through Caches
If your transaction-enabled cache is being used with a writer, write operations are queued until transaction commit time. A solely write-through approach would have its potential XAResource participate in the same transaction.
Write-behind is supported, however it should probably not be used with an XA transactional cache because the operations would never be part of the same transaction. Your writer would also be responsible for obtaining a new transaction.
Using Write-through with a non-XA resource would also work, but there is no guarantee the transaction will succeed after the write operations have been executed. On the other hand, any exception thrown during these write operations would cause the transaction to be rolled back by having UserTransaction.commit() throw a RollbackException.
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback