Package com.hazelcast.spring.transaction
Class HazelcastTransactionManager
java.lang.Object
org.springframework.transaction.support.AbstractPlatformTransactionManager
com.hazelcast.spring.transaction.HazelcastTransactionManager
- All Implemented Interfaces:
Serializable
,org.springframework.transaction.PlatformTransactionManager
,org.springframework.transaction.support.ResourceTransactionManager
public class HazelcastTransactionManager
extends org.springframework.transaction.support.AbstractPlatformTransactionManager
implements org.springframework.transaction.support.ResourceTransactionManager
PlatformTransactionManager
implementation
for a single HazelcastInstance
. Binds a Hazelcast TransactionContext
from the instance to the thread (as it is already bounded by Hazelcast itself) and makes it available for access.
Note: This transaction manager doesn't supports nested transactions, since Hazelcast doesn't support them either.
- Author:
- Balint Krivan
- See Also:
getTransactionContext(HazelcastInstance)
,getTransactionContext()
, Serialized Form
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description HazelcastTransactionManager(HazelcastInstance hazelcastInstance)
-
Method Summary
Modifier and Type Method Description protected void
doBegin(Object transaction, org.springframework.transaction.TransactionDefinition definition)
protected void
doCleanupAfterCompletion(Object transaction)
protected void
doCommit(org.springframework.transaction.support.DefaultTransactionStatus status)
protected Object
doGetTransaction()
protected void
doRollback(org.springframework.transaction.support.DefaultTransactionStatus status)
protected void
doSetRollbackOnly(org.springframework.transaction.support.DefaultTransactionStatus status)
Object
getResourceFactory()
TransactionContext
getTransactionContext()
Returns the transaction contextstatic TransactionContext
getTransactionContext(HazelcastInstance hazelcastInstance)
Returns the transaction context for the given Hazelcast instance bounded to the current thread.protected boolean
isExistingTransaction(Object transaction)
Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
commit, determineTimeout, doResume, doSuspend, getDefaultTimeout, getTransaction, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, newTransactionStatus, prepareForCommit, prepareSynchronization, prepareTransactionStatus, registerAfterCompletionWithExistingTransaction, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, shouldCommitOnGlobalRollbackOnly, suspend, triggerBeforeCommit, triggerBeforeCompletion, useSavepointForNestedTransaction
-
Constructor Details
-
Method Details
-
getTransactionContext
Returns the transaction context for the given Hazelcast instance bounded to the current thread.- Throws:
org.springframework.transaction.NoTransactionException
- if the transaction context cannot be found
-
getTransactionContext
Returns the transaction context- Throws:
org.springframework.transaction.NoTransactionException
- if the transaction context cannot be found
-
getResourceFactory
- Specified by:
getResourceFactory
in interfaceorg.springframework.transaction.support.ResourceTransactionManager
-
doGetTransaction
- Specified by:
doGetTransaction
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
- Throws:
org.springframework.transaction.TransactionException
-
isExistingTransaction
protected boolean isExistingTransaction(Object transaction) throws org.springframework.transaction.TransactionException- Overrides:
isExistingTransaction
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
- Throws:
org.springframework.transaction.TransactionException
-
doBegin
protected void doBegin(Object transaction, org.springframework.transaction.TransactionDefinition definition) throws org.springframework.transaction.TransactionException- Specified by:
doBegin
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
- Throws:
org.springframework.transaction.TransactionException
-
doCommit
protected void doCommit(org.springframework.transaction.support.DefaultTransactionStatus status) throws org.springframework.transaction.TransactionException- Specified by:
doCommit
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
- Throws:
org.springframework.transaction.TransactionException
-
doSetRollbackOnly
protected void doSetRollbackOnly(org.springframework.transaction.support.DefaultTransactionStatus status) throws org.springframework.transaction.TransactionException- Overrides:
doSetRollbackOnly
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
- Throws:
org.springframework.transaction.TransactionException
-
doRollback
protected void doRollback(org.springframework.transaction.support.DefaultTransactionStatus status) throws org.springframework.transaction.TransactionException- Specified by:
doRollback
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
- Throws:
org.springframework.transaction.TransactionException
-
doCleanupAfterCompletion
- Overrides:
doCleanupAfterCompletion
in classorg.springframework.transaction.support.AbstractPlatformTransactionManager
-