public abstract class AbstractJiniTransactionManager extends AbstractPlatformTransactionManager implements JiniPlatformTransactionManager, InitializingBean, BeanNameAware, ServiceDetailsProvider, DisposableBean
PlatformTransactionManager
. Uses Jini
TransactionManager
in order to manage transactions with sub classes responsible for
providing it using doCreateTransactionManager()
.
Jini transactions are bounded under the setTransactionalContext(Object)
using Springs
TransactionSynchronizationManager.bindResource(Object,Object)
. The transactional context
is optional and defaults to the Jini TransactionManager
instance. Note, this can be
overridden by sub classes.
By default the transaction timeout will be 90
seconds. The default timeout on the
transaction manager level can be set using AbstractPlatformTransactionManager.setDefaultTimeout(int)
. If the timeout is
explicitly set using Spring support for transactions (for example using
TransactionDefinition
) this value will be used.
DefaultTransactionProvider
,
JiniTransactionHolder
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
AbstractJiniTransactionManager.JiniTransactionObject
Jini Transaction object.
|
static class |
AbstractJiniTransactionManager.UnexpectedTransactionException |
AbstractPlatformTransactionManager.SuspendedResourcesHolder
Modifier and Type | Field and Description |
---|---|
protected String |
beanName |
protected static String |
SERVICE_TYPE |
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
Constructor and Description |
---|
AbstractJiniTransactionManager() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected void |
applyIsolationLevel(AbstractJiniTransactionManager.JiniTransactionObject txObject,
int isolationLevel) |
protected RuntimeException |
convertJiniException(Exception exception) |
void |
destroy() |
protected void |
doBegin(Object transaction,
TransactionDefinition definition) |
protected void |
doCleanupAfterCompletion(Object transaction) |
protected void |
doCommit(DefaultTransactionStatus status) |
protected abstract TransactionManager |
doCreateTransactionManager()
Implemented by sub classes to provide a Jini
TransactionManager . |
protected Object |
doGetTransaction() |
protected void |
doJiniBegin(AbstractJiniTransactionManager.JiniTransactionObject txObject,
TransactionDefinition definition) |
protected void |
doResume(Object transaction,
Object suspendedResources) |
protected void |
doRollback(DefaultTransactionStatus status) |
protected void |
doSetRollbackOnly(DefaultTransactionStatus status) |
protected Object |
doSuspend(Object transaction) |
String |
getBeanName() |
Object |
getTransactionalContext()
Returns the transactional context the jini transaction is bounded under (usually using Spring
synchronization which is based on thread local).
|
TransactionManager |
getTransactionManager() |
protected boolean |
isExistingTransaction(Object transaction) |
protected String |
logMessage(String message) |
void |
setBeanName(String beanName) |
void |
setCommitTimeout(Long commitTimeout)
Sets an optional timeout when performing commit in milliseconds.
|
void |
setLeaseRenewalConfig(TransactionLeaseRenewalConfig leaseRenewalConfig)
Sets the transaction lease renewal configuration.
|
void |
setRollbackTimeout(Long rollbackTimeout)
Sets an optional timeout when performing rollback/abort in milliseconds.
|
void |
setTransactionalContext(Object txResource) |
protected boolean |
suppportsCustomIsolationLevel() |
protected boolean |
useSavepointForNestedTransaction() |
commit, determineTimeout, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
commit, getTransaction, rollback
getServicesDetails
protected static final String SERVICE_TYPE
protected String beanName
public void setBeanName(String beanName)
setBeanName
in interface BeanNameAware
public String getBeanName()
getBeanName
in interface JiniPlatformTransactionManager
public Object getTransactionalContext()
JiniPlatformTransactionManager
getTransactionalContext
in interface JiniPlatformTransactionManager
public void setTransactionalContext(Object txResource)
public void setCommitTimeout(Long commitTimeout)
DEFAULT_TX_COMMIT_TIMEOUT
.public void setRollbackTimeout(Long rollbackTimeout)
DEFAULT_TX_ROLLBACK_TIMEOUT
.public void setLeaseRenewalConfig(TransactionLeaseRenewalConfig leaseRenewalConfig)
protected abstract TransactionManager doCreateTransactionManager() throws Exception
TransactionManager
.Exception
public TransactionManager getTransactionManager()
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
protected Object doGetTransaction() throws TransactionException
doGetTransaction
in class AbstractPlatformTransactionManager
TransactionException
protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException
doBegin
in class AbstractPlatformTransactionManager
TransactionException
protected void doJiniBegin(AbstractJiniTransactionManager.JiniTransactionObject txObject, TransactionDefinition definition)
protected void applyIsolationLevel(AbstractJiniTransactionManager.JiniTransactionObject txObject, int isolationLevel) throws InvalidIsolationLevelException
InvalidIsolationLevelException
protected boolean suppportsCustomIsolationLevel()
protected void doCommit(DefaultTransactionStatus status) throws TransactionException
doCommit
in class AbstractPlatformTransactionManager
TransactionException
protected boolean isExistingTransaction(Object transaction) throws TransactionException
isExistingTransaction
in class AbstractPlatformTransactionManager
TransactionException
protected void doRollback(DefaultTransactionStatus status) throws TransactionException
doRollback
in class AbstractPlatformTransactionManager
TransactionException
protected void doCleanupAfterCompletion(Object transaction)
doCleanupAfterCompletion
in class AbstractPlatformTransactionManager
protected void doSetRollbackOnly(DefaultTransactionStatus status) throws TransactionException
doSetRollbackOnly
in class AbstractPlatformTransactionManager
TransactionException
protected void doResume(Object transaction, Object suspendedResources) throws TransactionException
doResume
in class AbstractPlatformTransactionManager
TransactionException
protected Object doSuspend(Object transaction) throws TransactionException
doSuspend
in class AbstractPlatformTransactionManager
TransactionException
protected boolean useSavepointForNestedTransaction()
useSavepointForNestedTransaction
in class AbstractPlatformTransactionManager
protected RuntimeException convertJiniException(Exception exception)
Copyright © GigaSpaces.