GigaSpaces XAP 8.0 API

org.openspaces.core.transaction
Class DefaultTransactionProvider

java.lang.Object
  extended by org.openspaces.core.transaction.DefaultTransactionProvider
All Implemented Interfaces:
TransactionProvider

public class DefaultTransactionProvider
extends Object
implements TransactionProvider

Default transaction provider works in conjunction with 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:
AbstractJiniTransactionManager, GigaSpaceFactoryBean, JiniTransactionHolder, TransactionSynchronizationManager

Constructor Summary
DefaultTransactionProvider(Object actualTransactionalContext, PlatformTransactionManager transactionManager)
          Creates a new transaction provider.
 
Method Summary
 Transaction.Created 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).
 int getCurrentTransactionIsolationLevel(Object transactionalContext)
          Returns the currently running transaction isolation level (mapping to Spring TransactionDefinition.getIsolationLevel() values).
 JiniTransactionHolder getHolder()
           
 PlatformTransactionManager getTransactionManager()
           
 boolean isEnabled()
          Returns true if this transaction provider is enabled or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTransactionProvider

public DefaultTransactionProvider(Object actualTransactionalContext,
                                  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 Detail

getCurrentTransaction

public Transaction.Created 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).

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 form AbstractJiniTransactionManager.

If no transaction is found bound the the transactional context (provided in the constructor), null is returned. This means that operations will execute without a transaction.

Specified by:
getCurrentTransaction in interface TransactionProvider
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 null if no transaction is running

getTransactionManager

public PlatformTransactionManager getTransactionManager()

getHolder

public JiniTransactionHolder getHolder()

getCurrentTransactionIsolationLevel

public int getCurrentTransactionIsolationLevel(Object transactionalContext)
Description copied from interface: TransactionProvider
Returns the currently running transaction isolation level (mapping to Spring TransactionDefinition.getIsolationLevel() values). A transactional context can be passed and optionally used in order to fetch the current running transaction.

Specified by:
getCurrentTransactionIsolationLevel in interface TransactionProvider
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: TransactionProvider
Returns true if this transaction provider is enabled or not.

Specified by:
isEnabled in interface TransactionProvider

GigaSpaces XAP 8.0 API

Copyright © GigaSpaces.