|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface TxnObject
The interface each transactional object needs to implement.
A TxnObject is an object where all reads/writes are managed through a Txn (unless an atomic
method is used).
Each TxnObject belongs to 1 Stm instance.
All methods are threadsafe.
| Method Summary | |
|---|---|
String |
atomicToString()
Returns a String representation of the object using the provided transaction without looking at a TxnThreadLocal. |
void |
ensure()
Does an ensure. |
void |
ensure(Txn self)
Does an ensure. |
Lock |
getLock()
Gets the Lock that belongs to this TxnObject. |
Stm |
getStm()
Returns the Stm this TxnObject is part of. |
long |
getVersion()
Returns the current version of the transactional object. |
String |
toDebugString()
Returns a debug representation of the TxnObject. |
String |
toString()
Returns a String representation of the Object using the Txn on the TxnThreadLocal. |
String |
toString(Txn txn)
Returns a String representation of the object using the provided Txn. |
| Method Detail |
|---|
Stm getStm()
Stm this TxnObject is part of. Once a TxnObject is created using some
Stm, it will never become part of another Stm.
Lock getLock()
Lock that belongs to this TxnObject. This call doesn't cause any locking, it
only provides access to the object that is able to lock. The returned value will never be null.
This call also doesn't rely on a Txn.
UnsupportedOperationException - if this operation is not supported.long getVersion()
This method doesn't look at the TxnThreadLocal.
void ensure()
IsolationLevel for more detail about the writeskew problem}
This can safely be called on an TxnObject that already is locked, although it doesn't provide much value since with a locked TxnObject, since the writeskew problem can't occur anymore because it can't be changed.
Unlike the Lock.acquire(LockMode) which is pessimistic, ensure is optimistic. This means that a conflict
can be detected once the transaction commits.
This method has no effect if the Txn is readonly, because a writeskew is not possible with a
readonly transaction.
This call lifts on the Txn stored in the TxnThreadLocal.
TxnExecutionException
ControlFlowErrorensure(Txn)void ensure(Txn self)
IsolationLevel for more detail about the writeskew problem}
This can safely be called on an TxnObject that already is locked, although it doesn't provide much value since with a locked TxnObject, since the writeskew problem can't occur anymore because it can't be changed.
Unlike the Lock.acquire(LockMode) which is pessimistic, ensure is optimistic. This means that a conflict
can be detected once the transaction commits.
This method has no effect if the Txn is readonly, because a writeskew is not possible with a
readonly transaction.
self - the Txn this call lifts on.
NullPointerException - if self is null.
TxnExecutionException
ControlFlowErrorensure()String toDebugString()
String toString()
Txn on the TxnThreadLocal.
toString in class ObjectTxnExecutionException
ControlFlowErrorString toString(Txn txn)
Txn.
txn - the Txn used.
NullPointerException - if tx is null.
ControlFlowErrorString atomicToString()
TxnThreadLocal. The outputted value doesn't need to be consistent from some point
in time, only a best effort is made.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||