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,
org.springframework.transaction.PlatformTransactionManager transactionManager)
Creates a new transaction provider.
|
DefaultTransactionProvider(org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
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() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
boolean |
isEnabled()
Returns
true if this transaction provider is enabled or not. |
public DefaultTransactionProvider(org.springframework.transaction.PlatformTransactionManager transactionManager)
public DefaultTransactionProvider(Object actualTransactionalContext, org.springframework.transaction.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 org.springframework.transaction.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
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © GigaSpaces.