Class DefaultTransactionProvider
- All Implemented Interfaces:
SpaceTransactionProvider,Closeable,AutoCloseable,TransactionProvider
JiniPlatformTransactionManager and one of its derived classes. Uses Spring support for
transactional resource binding (using thread local) in order to get the current transaction. If
no transaction is active, will return null (which means the operation will be
executed under no transaction).
Also supports for Spring JTA transaction by automatically creating and binding GigaSpaces support for XA.
As a transaction context it uses the one passed to its constructor, and not the runtime
transactional context provided to getCurrentTransaction(Object, com.j_spaces.core.IJSpace)
- Author:
- kimchy
- See Also:
-
AbstractJiniTransactionManagerGigaSpaceFactoryBeanJiniTransactionHolderTransactionSynchronizationManager
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTransactionProvider(IJSpace space, Object actualTransactionalContext, org.springframework.transaction.PlatformTransactionManager transactionManager) Creates a new transaction provider.DefaultTransactionProvider(IJSpace space, org.springframework.transaction.PlatformTransactionManager transactionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddestroy()Returns the currently running transaction (usually managed externally/declarative).getCurrentTransaction(Object transactionalContext, IJSpace space) Returns the current running transaction based on the constructor provided transactional context (Note that the passed transactional context is not used).Returns the currently running transaction isolation level.intgetCurrentTransactionIsolationLevel(Object transactionalContext) Returns the currently running transaction isolation level (mapping to SpringTransactionDefinition.getIsolationLevel()values).org.springframework.transaction.PlatformTransactionManagerbooleanReturnstrueif this transaction provider is enabled or not.
-
Constructor Details
-
DefaultTransactionProvider
public DefaultTransactionProvider(IJSpace space, org.springframework.transaction.PlatformTransactionManager transactionManager) -
DefaultTransactionProvider
public DefaultTransactionProvider(IJSpace space, Object actualTransactionalContext, org.springframework.transaction.PlatformTransactionManager transactionManager) Creates a new transaction provider. Will use the provided transactional context in order to fetch the current running transaction.- Parameters:
actualTransactionalContext- The transactional context to fetch the transaction by
-
-
Method Details
-
getCurrentTransaction
Description copied from interface:SpaceTransactionProviderReturns the currently running transaction (usually managed externally/declarative).If no transaction is currently executing,
nullvalue will be returned. This usually means that the operation will be performed without a transaction.- Specified by:
getCurrentTransactionin interfaceSpaceTransactionProvider- Returns:
- The transaction object to be used (can be
null).
-
getCurrentTransaction
Returns the current running transaction based on the constructor provided transactional context (Note that the passed transactional context is not used).Uses Spring support for transactional resource registration in order to fetch the current running transaction (or the
JiniTransactionHolder. An example of Spring platform transaction managers that register it are ones derived formAbstractJiniTransactionManager.If no transaction is found bound the the transactional context (provided in the constructor),
nullis returned. This means that operations will execute without a transaction.- Specified by:
getCurrentTransactionin interfaceTransactionProvider- Parameters:
transactionalContext- Not Used. The transactional context used is the one provided in the constructor.space- The actual Space this operation will be performed on- Returns:
- The current running transaction or
nullif no transaction is running
-
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager() -
getHolder
-
getCurrentTransactionIsolationLevel
Description copied from interface:SpaceTransactionProviderReturns the currently running transaction isolation level.- Specified by:
getCurrentTransactionIsolationLevelin interfaceSpaceTransactionProvider- Returns:
- The transaction isolation level.
-
getCurrentTransactionIsolationLevel
Description copied from interface:TransactionProviderReturns the currently running transaction isolation level (mapping to SpringTransactionDefinition.getIsolationLevel()values). A transactional context can be passed and optionally used in order to fetch the current running transaction.- Specified by:
getCurrentTransactionIsolationLevelin interfaceTransactionProvider- Parameters:
transactionalContext- Transactional context to (optionally) fetch the transaction by- Returns:
- The transaction isolation level mapping to Spring
TransactionDefinition.getIsolationLevel().
-
isEnabled
public boolean isEnabled()Description copied from interface:SpaceTransactionProviderReturnstrueif this transaction provider is enabled or not.- Specified by:
isEnabledin interfaceSpaceTransactionProvider
-
destroy
- Throws:
RemoteException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-