public class LocalTransactionContext extends Object
Constructor and Description |
---|
LocalTransactionContext(int transactionTimeout,
TransactionIDFactory transactionIdFactory)
Create a new LocalTransactionContext
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(TransactionListener listener)
Add a TransactionListener to this context
|
void |
commit(boolean ignoreTimeout)
Commit all work done in the context and release all registered soft locks
|
boolean |
equals(Object obj) |
List<SoftLock> |
getSoftLocksForCache(String cacheName)
Get all soft locks registered in this context for a specific cache
|
TransactionID |
getTransactionId()
Get the transaction ID of the context
|
int |
hashCode() |
boolean |
hasLockedAnything()
Check if anything was locked in this transaction's context
|
void |
registerSoftLock(String cacheName,
LocalTransactionStore store,
SoftLock softLock)
Register a soft lock in the context
|
void |
rollback()
Rollback all work done in the context and release all registered soft locks
|
void |
setRollbackOnly()
Mark the context for rollback
|
long |
timeBeforeTimeout()
Get the time until this context will expire
|
boolean |
timedOut()
Check if the context timed out
|
void |
updateSoftLock(String cacheName,
SoftLock softLock)
Update a soft lock already registered in the context
|
public LocalTransactionContext(int transactionTimeout, TransactionIDFactory transactionIdFactory)
transactionTimeout
- the timeout before the context expirestransactionIdFactory
- the transaction ID factory to retrieve a new transaction id frompublic boolean timedOut()
public long timeBeforeTimeout()
public void setRollbackOnly()
public void registerSoftLock(String cacheName, LocalTransactionStore store, SoftLock softLock)
cacheName
- the name of the cache this soft lock is instore
- the LocalTransactionStore this soft lock is insoftLock
- the soft lockpublic void updateSoftLock(String cacheName, SoftLock softLock)
cacheName
- the name of the cache this soft lock is insoftLock
- the soft lockpublic List<SoftLock> getSoftLocksForCache(String cacheName)
cacheName
- the name of the cachepublic boolean hasLockedAnything()
public void commit(boolean ignoreTimeout)
ignoreTimeout
- true if commit should proceed no matter the timeoutpublic void rollback()
public TransactionID getTransactionId()
public void addListener(TransactionListener listener)
listener
- the listenerCopyright © 2003–2016 Terracotta, Inc.. All rights reserved.