|
SRJRCFrames v0.1.296 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Transaction
A transaction with an interface similar to
Transaction, but with slightly different approach.
This Transaction is like a cake-recipe, so you can add arbitrary
TransactionalOperations. As creating a cake-recipe doesn't produce
anything eatable, creating a Transaction does not perform any of its
operations.
Use execute to perform all steps of the Transaction. The
Transaction passes control to Repository on execution and as
Repository uses EntityManagers for persistence tasks,
enlisting and delisting of TransactionResources happens during
transaction execution. Application does not need to care about
TransactionResources.
Transaction implementation should add support for
VetoableChangeListener on the TransactionStatus. The listener
may throw different types of veto:
TryAgainTransactionException - which is used to pause the active
transaction for a possible partner to get synchronized. So the exception
contains a field seconds, which indicates the transaction manager to
wait that amount of time and then try it again.AbortTransaction - should be used, when a transaction partner can
not succeed in synchronization.
TryAgainTransactionException,
AbortTransactionException| Method Summary | |
|---|---|
void |
add(TransactionalOperation<?> tao)
used to add an operation to the transaction. |
void |
addVetoableStatusListener(VetoableChangeListener listener)
add vetoable change listener to the transaction. |
void |
execute()
executes all added operations |
TransactionalOperation.DataDirection |
getDataDirection()
internal use only. |
List<TransactionalOperation<?>> |
getOperations()
internal use only. |
TransactionResource<?> |
getResource(EntityManager em)
internal use only. |
TransactionStatus |
getStatus()
accessor to the transactions status |
boolean |
isEntityManagerRegistered(EntityManager em)
internal use only. |
boolean |
isRollbackOnly()
internal use only. |
Collection<EntityManager> |
registeredManagers()
internal use only. |
void |
registerResource(EntityManager em,
TransactionResource<?> resource)
internal use only. |
void |
setRollbackOnly()
use this, if the transaction does only read operations. |
void |
setStatus(TransactionStatus ts)
internal use only. |
| Method Detail |
|---|
void add(TransactionalOperation<?> tao)
tao - the operation to add to the transactionvoid addVetoableStatusListener(VetoableChangeListener listener)
listener - - the listener to addvoid execute()
TransactionalOperation.DataDirection getDataDirection()
EntityManager to open
the TransactionResource in an appropriate way.
List<TransactionalOperation<?>> getOperations()
Repository
TransactionResource<?> getResource(EntityManager em)
Repository
em - the EntityManager, that created that resource
TransactionResourceTransactionStatus getStatus()
boolean isEntityManagerRegistered(EntityManager em)
Repository
em - the EntityManager of interest
EntityManager has been used in a previous
operation, otherwise falseboolean isRollbackOnly()
Repository
Collection<EntityManager> registeredManagers()
Repository
EntityManagers
void registerResource(EntityManager em,
TransactionResource<?> resource)
Repository
em - the EntityManager, that created the
TransactionResourceresource - the created TransactionResourcevoid setRollbackOnly()
Entity
void setStatus(TransactionStatus ts)
throws PropertyVetoException
Repository
ts - the new status
PropertyVetoException
|
SRJRCFrames v0.1.296 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||