GigaSpaces XAP 9.7.2 API

org.openspaces.core.transaction.manager
Class AbstractJiniTransactionManager

java.lang.Object
  extended by org.springframework.transaction.support.AbstractPlatformTransactionManager
      extended by org.openspaces.core.transaction.manager.AbstractJiniTransactionManager
All Implemented Interfaces:
Serializable, JiniPlatformTransactionManager, ServiceDetailsProvider, Aware, BeanNameAware, DisposableBean, InitializingBean, PlatformTransactionManager
Direct Known Subclasses:
DirectJiniTransactionManager, DistributedJiniTransactionManager, LookupJiniTransactionManager

public abstract class AbstractJiniTransactionManager
extends AbstractPlatformTransactionManager
implements JiniPlatformTransactionManager, InitializingBean, BeanNameAware, ServiceDetailsProvider, DisposableBean

Base class for Jini implementation of Springs 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.

Author:
kimchy
See Also:
DefaultTransactionProvider, JiniTransactionHolder, Serialized Form

Nested Class Summary
static class AbstractJiniTransactionManager.JiniTransactionObject
          Jini Transaction object.
static class AbstractJiniTransactionManager.UnexpectedTransactionException
           
 
Nested classes/interfaces inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
AbstractPlatformTransactionManager.SuspendedResourcesHolder
 
Field Summary
protected  String beanName
           
protected static String SERVICE_TYPE
           
 
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
 
Constructor Summary
AbstractJiniTransactionManager()
           
 
Method Summary
 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()
           
 
Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.transaction.PlatformTransactionManager
commit, getTransaction, rollback
 
Methods inherited from interface org.openspaces.pu.service.ServiceDetailsProvider
getServicesDetails
 

Field Detail

SERVICE_TYPE

protected static final String SERVICE_TYPE
See Also:
Constant Field Values

beanName

protected String beanName
Constructor Detail

AbstractJiniTransactionManager

public AbstractJiniTransactionManager()
Method Detail

setBeanName

public void setBeanName(String beanName)
Specified by:
setBeanName in interface BeanNameAware

getBeanName

public String getBeanName()
Specified by:
getBeanName in interface JiniPlatformTransactionManager

getTransactionalContext

public Object getTransactionalContext()
Description copied from interface: JiniPlatformTransactionManager
Returns the transactional context the jini transaction is bounded under (usually using Spring synchronization which is based on thread local).

Specified by:
getTransactionalContext in interface JiniPlatformTransactionManager

setTransactionalContext

public void setTransactionalContext(Object txResource)

setCommitTimeout

public void setCommitTimeout(Long commitTimeout)
Sets an optional timeout when performing commit in milliseconds. Default: DEFAULT_TX_COMMIT_TIMEOUT.


setRollbackTimeout

public void setRollbackTimeout(Long rollbackTimeout)
Sets an optional timeout when performing rollback/abort in milliseconds. Default: DEFAULT_TX_ROLLBACK_TIMEOUT.


setLeaseRenewalConfig

public void setLeaseRenewalConfig(TransactionLeaseRenewalConfig leaseRenewalConfig)
Sets the transaction lease renewal configuration. Once set, transactions will be renewed automatically. If not set, no renewals will occur.


doCreateTransactionManager

protected abstract TransactionManager doCreateTransactionManager()
                                                          throws Exception
Implemented by sub classes to provide a Jini TransactionManager.

Throws:
Exception

getTransactionManager

public TransactionManager getTransactionManager()

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

doGetTransaction

protected Object doGetTransaction()
                           throws TransactionException
Specified by:
doGetTransaction in class AbstractPlatformTransactionManager
Throws:
TransactionException

doBegin

protected void doBegin(Object transaction,
                       TransactionDefinition definition)
                throws TransactionException
Specified by:
doBegin in class AbstractPlatformTransactionManager
Throws:
TransactionException

doJiniBegin

protected void doJiniBegin(AbstractJiniTransactionManager.JiniTransactionObject txObject,
                           TransactionDefinition definition)

applyIsolationLevel

protected void applyIsolationLevel(AbstractJiniTransactionManager.JiniTransactionObject txObject,
                                   int isolationLevel)
                            throws InvalidIsolationLevelException
Throws:
InvalidIsolationLevelException

suppportsCustomIsolationLevel

protected boolean suppportsCustomIsolationLevel()

doCommit

protected void doCommit(DefaultTransactionStatus status)
                 throws TransactionException
Specified by:
doCommit in class AbstractPlatformTransactionManager
Throws:
TransactionException

isExistingTransaction

protected boolean isExistingTransaction(Object transaction)
                                 throws TransactionException
Overrides:
isExistingTransaction in class AbstractPlatformTransactionManager
Throws:
TransactionException

doRollback

protected void doRollback(DefaultTransactionStatus status)
                   throws TransactionException
Specified by:
doRollback in class AbstractPlatformTransactionManager
Throws:
TransactionException

doCleanupAfterCompletion

protected void doCleanupAfterCompletion(Object transaction)
Overrides:
doCleanupAfterCompletion in class AbstractPlatformTransactionManager

doSetRollbackOnly

protected void doSetRollbackOnly(DefaultTransactionStatus status)
                          throws TransactionException
Overrides:
doSetRollbackOnly in class AbstractPlatformTransactionManager
Throws:
TransactionException

doResume

protected void doResume(Object transaction,
                        Object suspendedResources)
                 throws TransactionException
Overrides:
doResume in class AbstractPlatformTransactionManager
Throws:
TransactionException

doSuspend

protected Object doSuspend(Object transaction)
                    throws TransactionException
Overrides:
doSuspend in class AbstractPlatformTransactionManager
Throws:
TransactionException

useSavepointForNestedTransaction

protected boolean useSavepointForNestedTransaction()
Overrides:
useSavepointForNestedTransaction in class AbstractPlatformTransactionManager

convertJiniException

protected RuntimeException convertJiniException(Exception exception)

logMessage

protected String logMessage(String message)

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.