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(IJSpace space,
Object actualTransactionalContext,
org.springframework.transaction.PlatformTransactionManager transactionManager)
Creates a new transaction provider.
|
DefaultTransactionProvider(IJSpace space,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
destroy() |
Transaction |
getCurrentTransaction()
Returns the currently running transaction (usually managed externally/declarative).
|
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).
|
IsolationLevelModifiers |
getCurrentTransactionIsolationLevel()
Returns the currently running transaction isolation level.
|
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(IJSpace space, org.springframework.transaction.PlatformTransactionManager transactionManager)
public DefaultTransactionProvider(IJSpace space, Object actualTransactionalContext, org.springframework.transaction.PlatformTransactionManager transactionManager)
actualTransactionalContext
- The transactional context to fetch the transaction bypublic Transaction getCurrentTransaction()
SpaceTransactionProvider
If no transaction is currently executing, null
value will be returned. This
usually means that the operation will be performed without a transaction.
getCurrentTransaction
in interface SpaceTransactionProvider
null
).public 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 IsolationLevelModifiers getCurrentTransactionIsolationLevel()
SpaceTransactionProvider
getCurrentTransactionIsolationLevel
in interface SpaceTransactionProvider
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()
SpaceTransactionProvider
true
if this transaction provider is enabled or not.isEnabled
in interface SpaceTransactionProvider
public void destroy() throws RemoteException
RemoteException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © GigaSpaces.