public abstract class AbstractTransactionContext extends Object implements TransactionContext
Constructor and Description |
---|
AbstractTransactionContext(Transaction tx) |
Modifier and Type | Method and Description |
---|---|
void |
addAllLocks(List newLocks)
Adds a List of locks to the currently maintained collection of locks acquired.
|
void |
addDummyNodeCreatedByCacheLoader(Fqn fqn)
Adds an Fqn to the list of uninitialized nodes created by the cache loader.
|
void |
addLocalModification(WriteCommand command)
Adds a modification to the local modification list.
|
void |
addLock(Object lock)
Adds a lock to the currently maintained collection of locks acquired.
|
void |
addModification(WriteCommand command)
Adds a modification to the modification list.
|
void |
addRemovedNode(Fqn fqn)
Adds the node that has been removed in the scope of the current transaction.
|
void |
clearLocks()
Clears all locks from the currently maintained collection of locks acquired.
|
List<Fqn> |
getDummyNodesCreatedByCacheLoader() |
List<WriteCommand> |
getLocalModifications()
Returns all modifications that have been invoked with the LOCAL cache mode option.
|
List |
getLocks()
Returns an immutable, defensive copy of the List of locks currently maintained for the transaction.
|
List<WriteCommand> |
getModifications()
Returns all modifications.
|
Option |
getOption()
Retrieves a transaction scope option override
|
OrderedSynchronizationHandler |
getOrderedSynchronizationHandler() |
List<Fqn> |
getRemovedNodes()
Gets the list of removed nodes.
|
Transaction |
getTransaction()
Returns a local transaction associated with this context.
|
boolean |
hasAnyModifications() |
boolean |
hasLocalModifications() |
boolean |
hasLock(Object lock)
Most code could not use this method directly, but use
InvocationContext.hasLock(Object) ()} instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks. |
boolean |
hasModifications() |
boolean |
isForceAsyncReplication()
Gets the value of the forceAsyncReplication flag.
|
boolean |
isForceSyncReplication()
Gets the value of the forceSyncReplication flag.
|
void |
removeLock(Object lock)
Removes a lock from the currently maintained collection of locks acquired.
|
void |
reset()
Cleans up internal state, freeing up references.
|
void |
setForceAsyncReplication(boolean forceAsyncReplication)
Sets the value of the forceAsyncReplication flag.
|
void |
setForceSyncReplication(boolean forceSyncReplication)
Sets the value of the forceSyncReplication flag.
|
void |
setOption(Option o)
Sets a transaction-scope option override
|
void |
setOrderedSynchronizationHandler(OrderedSynchronizationHandler orderedSynchronizationHandler)
Associates an ordered sync handler with this transaction.
|
void |
setTransaction(Transaction tx)
Sets the local transaction to be associated with this transaction context.
|
String |
toString()
Returns debug information about this transaction.
|
public AbstractTransactionContext(Transaction tx) throws SystemException, RollbackException
SystemException
RollbackException
public void addModification(WriteCommand command)
TransactionContext
addModification
in interface TransactionContext
command
- modificationpublic List<WriteCommand> getModifications()
TransactionContext
getModifications
in interface TransactionContext
public void addLocalModification(WriteCommand command)
TransactionContext
addLocalModification
in interface TransactionContext
command
- command to add to list. Should not be null.public List<WriteCommand> getLocalModifications()
TransactionContext
getLocalModifications
in interface TransactionContext
public void addRemovedNode(Fqn fqn)
TransactionContext
addRemovedNode
in interface TransactionContext
fqn
- fqn that has been removed.public List<Fqn> getRemovedNodes()
TransactionContext
getRemovedNodes
in interface TransactionContext
public void setTransaction(Transaction tx)
TransactionContext
setTransaction
in interface TransactionContext
tx
- JTA transaction to associate with.public Transaction getTransaction()
TransactionContext
getTransaction
in interface TransactionContext
public void addLock(Object lock)
TransactionContext
InvocationContext.addLock(Object)
instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
Note that currently (as of 3.0.0) this lock is weakly typed. This is to allow support for both MVCC (which uses Fqn
s as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept Fqn
.addLock
in interface TransactionContext
lock
- lock to addInvocationContext.addLock(Object)
public void removeLock(Object lock)
TransactionContext
InvocationContext.removeLock(Object)
instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
Note that currently (as of 3.0.0) this lock is weakly typed. This is to allow support for both MVCC (which uses Fqn
s as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept Fqn
.removeLock
in interface TransactionContext
lock
- lock to removeInvocationContext.removeLock(Object)
public void clearLocks()
TransactionContext
InvocationContext.clearLocks()
instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
Note that currently (as of 3.0.0) this lock is weakly typed. This is to allow support for both MVCC (which uses Fqn
s as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept Fqn
.clearLocks
in interface TransactionContext
InvocationContext.clearLocks()
public boolean hasLock(Object lock)
TransactionContext
InvocationContext.hasLock(Object)
()} instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.hasLock
in interface TransactionContext
lock
- lock to testpublic void addAllLocks(List newLocks)
TransactionContext
InvocationContext.addAllLocks(java.util.List)
instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
Note that currently (as of 3.0.0) this list is unchecked. This is to allow support for both MVCC (which uses Fqns as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to accept ListaddAllLocks
in interface TransactionContext
newLocks
- locks to addInvocationContext.addAllLocks(java.util.List)
public List getLocks()
TransactionContext
InvocationContext.getLocks()
instead,
which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
Note that currently (as of 3.0.0) this list is unchecked. This is to allow support for both MVCC (which uses Fqns as locks)
as well as legacy Optimistic and Pessimistic Locking schemes (which use NodeLock
as locks). Once support for
legacy node locking schemes are dropped, this method will be more strongly typed to return ListgetLocks
in interface TransactionContext
InvocationContext.getLocks()
public boolean isForceAsyncReplication()
TransactionContext
Cache.putForExternalRead(org.jboss.cache.Fqn,Object,Object)
within
a transactional context.isForceAsyncReplication
in interface TransactionContext
public void setForceAsyncReplication(boolean forceAsyncReplication)
TransactionContext
Cache.putForExternalRead(org.jboss.cache.Fqn,Object,Object)
within
a transactional context. Also used by OptimisticReplicationInterceptor when dealing
with Option.setForceAsynchronous(boolean)
in a
non-transactional context (i.e. with an implicit transaction).setForceAsyncReplication
in interface TransactionContext
forceAsyncReplication
- value of forceAsyncReplicationpublic boolean isForceSyncReplication()
TransactionContext
Cache.putForExternalRead(org.jboss.cache.Fqn,Object,Object)
within
a transactional context.isForceSyncReplication
in interface TransactionContext
public void setForceSyncReplication(boolean forceSyncReplication)
TransactionContext
Cache.putForExternalRead(org.jboss.cache.Fqn,Object,Object)
within
a transactional context.setForceSyncReplication
in interface TransactionContext
forceSyncReplication
- value of forceSyncReplicationpublic String toString()
public void addDummyNodeCreatedByCacheLoader(Fqn fqn)
TransactionContext
addDummyNodeCreatedByCacheLoader
in interface TransactionContext
fqn
- fqn to add. Must not be null.public List<Fqn> getDummyNodesCreatedByCacheLoader()
getDummyNodesCreatedByCacheLoader
in interface TransactionContext
public void setOption(Option o)
TransactionContext
setOption
in interface TransactionContext
o
- option to setpublic Option getOption()
TransactionContext
getOption
in interface TransactionContext
public OrderedSynchronizationHandler getOrderedSynchronizationHandler()
getOrderedSynchronizationHandler
in interface TransactionContext
public void setOrderedSynchronizationHandler(OrderedSynchronizationHandler orderedSynchronizationHandler)
TransactionContext
setOrderedSynchronizationHandler
in interface TransactionContext
orderedSynchronizationHandler
- to setpublic boolean hasModifications()
hasModifications
in interface TransactionContext
public boolean hasLocalModifications()
hasLocalModifications
in interface TransactionContext
public boolean hasAnyModifications()
hasAnyModifications
in interface TransactionContext
public void reset()
TransactionContext
reset
in interface TransactionContext
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.