public class DefaultTransactionProvider extends Object implements 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)
AbstractJiniTransactionManager
,
GigaSpaceFactoryBean
,
JiniTransactionHolder
,
TransactionSynchronizationManager
Constructor and Description |
---|
DefaultTransactionProvider(Object actualTransactionalContext,
PlatformTransactionManager transactionManager)
Creates a new transaction provider.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
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. |
public DefaultTransactionProvider(Object actualTransactionalContext, PlatformTransactionManager transactionManager)
actualTransactionalContext
- The transactional context to fetch the transaction bypublic Transaction.Created getCurrentTransaction(Object transactionalContext, IJSpace space)
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.
getCurrentTransaction
in interface TransactionProvider
transactionalContext
- Not Used. The transactional context used is the one provided in the constructor.space
- The actual Space this operation will be performed onnull
if no transaction is runningpublic PlatformTransactionManager getTransactionManager()
public JiniTransactionHolder getHolder()
public int getCurrentTransactionIsolationLevel(Object transactionalContext)
TransactionProvider
TransactionDefinition.getIsolationLevel()
values). A
transactional context can be passed and optionally used in order to fetch the current running
transaction.getCurrentTransactionIsolationLevel
in interface TransactionProvider
transactionalContext
- Transactional context to (optionally) fetch the transaction byTransactionDefinition.getIsolationLevel()
.public boolean isEnabled()
TransactionProvider
true
if this transaction provider is enabled or not.isEnabled
in interface TransactionProvider
public void destroy() throws RemoteException
RemoteException
Copyright © GigaSpaces.