|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.multiverse.stms.gamma.transactionalobjects.AbstractGammaObject
org.multiverse.stms.gamma.transactionalobjects.BaseGammaTxnRef
org.multiverse.stms.gamma.transactionalobjects.GammaTxnRef<E>
E - public class GammaTxnRef<E>
A TxnRef tailored for the GammaStm.
| Field Summary |
|---|
| Fields inherited from class org.multiverse.stms.gamma.transactionalobjects.BaseGammaTxnRef |
|---|
long_value, ref_value, type |
| Fields inherited from class org.multiverse.stms.gamma.transactionalobjects.AbstractGammaObject |
|---|
___unsafe, identityHashCode, listeners, listenersOffset, MASK_OREC_EXCLUSIVELOCK, MASK_OREC_READBIASED, MASK_OREC_READLOCKS, MASK_OREC_READONLY_COUNT, MASK_OREC_SURPLUS, MASK_OREC_UPDATELOCK, orec, stm, valueOffset, version |
| Fields inherited from interface org.multiverse.MultiverseConstants |
|---|
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED |
| Constructor Summary | |
|---|---|
GammaTxnRef(E value)
|
|
GammaTxnRef(GammaStm stm)
|
|
GammaTxnRef(GammaStm stm,
E value)
|
|
GammaTxnRef(GammaTxn tx)
|
|
GammaTxnRef(GammaTxn tx,
E value)
|
|
| Method Summary | |
|---|---|
E |
alterAndGet(Function<E> function)
Alters the value stored in this Ref using the provided function and returns the result. |
E |
alterAndGet(GammaTxn tx,
Function<E> function)
|
E |
alterAndGet(Txn tx,
Function<E> function)
Alters the value stored in this Ref using the provided function and lifting on the provided txn. |
E |
atomicAlterAndGet(Function<E> function)
Atomically applies the function to the current value in this ref and returns the new value. |
boolean |
atomicCompareAndSet(E expectedValue,
E newValue)
Executes a compare and set atomically. |
E |
atomicGet()
Atomically gets the value. |
E |
atomicGetAndAlter(Function<E> function)
Atomically applies the function to alter the value stored in this ref and returns the old value. |
E |
atomicGetAndSet(E newValue)
Atomically sets the value and returns the previous value. |
boolean |
atomicIsNull()
Atomically check if the current value is null. |
E |
atomicSet(E newValue)
Atomically sets the value and returns the new value. |
String |
atomicToString()
Returns a String representation of the object using the provided transaction without looking at a TxnThreadLocal. |
E |
atomicWeakGet()
Atomically gets the value without providing any ordering guarantees. |
void |
await(E value)
Awaits for the value to become the given value. |
void |
await(GammaTxn tx,
E value)
|
void |
await(GammaTxn tx,
Predicate<E> predicate)
|
void |
await(Predicate<E> predicate)
Awaits until the predicate holds. |
void |
await(Txn tx,
E value)
Awaits for the reference to become the given value. |
void |
await(Txn tx,
Predicate<E> predicate)
Awaits until the predicate holds using the provided txn. |
E |
awaitNotNullAndGet()
Awaits for the value to become not null. |
E |
awaitNotNullAndGet(GammaTxn tx)
|
E |
awaitNotNullAndGet(Txn tx)
Awaits for the value to become not null using the provided txn. |
void |
awaitNull()
Awaits for the value to become null. |
void |
awaitNull(GammaTxn tx)
|
void |
awaitNull(Txn tx)
Awaits for the value to become not null using the provided txn. |
void |
commute(Function<E> function)
Applies the function on the ref in a commuting manner. |
void |
commute(GammaTxn tx,
Function<E> function)
|
void |
commute(Txn tx,
Function<E> function)
Applies the function on the ref in a commuting manner. |
E |
get()
Gets the value using the provided txn. |
E |
get(GammaTxn tx)
|
E |
get(Txn tx)
Gets the value using the provided txn. |
E |
getAndAlter(Function<E> function)
Alters the value stored in this Ref using the provided function amd returns the old value. |
E |
getAndAlter(GammaTxn tx,
Function<E> function)
|
E |
getAndAlter(Txn tx,
Function<E> function)
Alters the value stored in this Ref using the function and returns the old value, using the provided txn. |
E |
getAndLock(GammaTxn tx,
LockMode lockMode)
|
E |
getAndLock(LockMode lockMode)
Gets the value and applies the lock. |
E |
getAndLock(Txn tx,
LockMode lockMode)
Gets the value using the provided txn and acquired the lock with the specified LockMode. |
E |
getAndSet(E value)
Sets the value the value and returns the new value. |
E |
getAndSet(GammaTxn tx,
E value)
|
E |
getAndSet(Txn tx,
E value)
Sets the value using the provided txn. |
E |
getAndSetAndLock(E value,
LockMode lockMode)
Sets the value, acquired the Lock with the specified Lockmode and returns the previous value. |
E |
getAndSetAndLock(GammaTxn tx,
E value,
LockMode lockMode)
|
E |
getAndSetAndLock(Txn tx,
E value,
LockMode lockMode)
Sets the value and acquired the Lock with the provided LockMode. |
boolean |
isNull()
Checks if the current value is null. |
boolean |
isNull(GammaTxn tx)
|
boolean |
isNull(Txn tx)
Checks if the current value is null using the provided txn. |
E |
set(E value)
Sets the new value. |
E |
set(GammaTxn tx,
E value)
|
E |
set(Txn tx,
E value)
Sets the new value using the provided txn. |
E |
setAndLock(E value,
LockMode lockMode)
Sets the new value and applies the lock. |
E |
setAndLock(GammaTxn tx,
E value,
LockMode lockMode)
|
E |
setAndLock(Txn tx,
E value,
LockMode lockMode)
Sets the new value using the provided txn. |
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(GammaTxn tx)
|
String |
toString(Txn tx)
Returns a String representation of the object using the provided Txn. |
| Methods inherited from class org.multiverse.stms.gamma.transactionalobjects.BaseGammaTxnRef |
|---|
acquire, acquire, acquire, arriveAndExclusiveLockOrBackoff, atomicCompareAndSetLong, atomicGetLong, atomicObjectGet, atomicSetLong, atomicSetObject, commit, ensure, ensure, ensure, flattenCommute, getLong, getObject, hasReadConflict, leanCommit, load, openForCommute, openForCommute, openForCommute, openForCommute, openForConstruction, openForConstruction, openForConstruction, openForConstruction, openForRead, openForRead, openForRead, openForRead, openForRead, openForRead, openForWrite, openForWrite, openForWrite, openForWrite, openForWrite, openForWrite, prepare, registerChangeListener, releaseAfterFailure, releaseAfterReading, releaseAfterUpdate, setLong, setObject, tryLockAndCheckConflict |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.multiverse.api.TxnObject |
|---|
ensure, ensure, getLock, getStm, getVersion |
| Constructor Detail |
|---|
public GammaTxnRef(E value)
public GammaTxnRef(GammaTxn tx)
public GammaTxnRef(GammaTxn tx,
E value)
public GammaTxnRef(GammaStm stm)
public GammaTxnRef(GammaStm stm,
E value)
| Method Detail |
|---|
public final E get()
TxnRef
get in interface TxnRef<E>TxnRef.atomicGet()public final E get(Txn tx)
TxnRef
get in interface TxnRef<E>tx - the Txn used for this operation.
public final E get(GammaTxn tx)
public final E getAndLock(LockMode lockMode)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
getAndLock in interface TxnRef<E>lockMode - the LockMode applied.
TxnRef.atomicGet()
public final E getAndLock(Txn tx,
LockMode lockMode)
TxnRef
getAndLock in interface TxnRef<E>tx - the Txn used for this operation.lockMode - the LockMode used
public final E getAndLock(GammaTxn tx,
LockMode lockMode)
public final E set(E value)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
set in interface TxnRef<E>value - the new value.
public final E set(Txn tx,
E value)
TxnRef
set in interface TxnRef<E>tx - the Txn used for this operation.value - the new value
public final E set(GammaTxn tx,
E value)
public final E setAndLock(E value,
LockMode lockMode)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
setAndLock in interface TxnRef<E>value - the new value.lockMode - the used LockMode.
public final E setAndLock(Txn tx,
E value,
LockMode lockMode)
TxnRef
setAndLock in interface TxnRef<E>tx - the Txn used for this operation.value - the new valuelockMode - the lockMode used.
public final E setAndLock(GammaTxn tx,
E value,
LockMode lockMode)
public final E getAndSet(E value)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
getAndSet in interface TxnRef<E>value - the new value.
public final E getAndSet(Txn tx,
E value)
TxnRef
getAndSet in interface TxnRef<E>tx - the Txn used for this operation.value - the new value.
public final E getAndSet(GammaTxn tx,
E value)
public final E getAndSetAndLock(E value,
LockMode lockMode)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
getAndSetAndLock in interface TxnRef<E>value - the new value.lockMode - the LockMode used.
public final E getAndSetAndLock(Txn tx,
E value,
LockMode lockMode)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
getAndSetAndLock in interface TxnRef<E>tx - the Txn used for this operation.value - the new value.lockMode - the LockMode used.
public final E getAndSetAndLock(GammaTxn tx,
E value,
LockMode lockMode)
public final E atomicGet()
TxnRefTxnRef.atomicWeakGet().
atomicGet in interface TxnRef<E>public final E atomicWeakGet()
TxnRefIt is the best method to call if you just want to get the current value stored.
atomicWeakGet in interface TxnRef<E>public final E atomicSet(E newValue)
TxnRef
atomicSet in interface TxnRef<E>newValue - the new value.
public final E atomicGetAndSet(E newValue)
TxnRef
atomicGetAndSet in interface TxnRef<E>newValue - the new value.
public final void commute(Function<E> function)
TxnRefThis is different than the behavior in Clojure where the commute will be re-applied at the end of the txn, even though some dependency is introduced, which can lead to inconsistencies.
This call lifts on the Txn stored in the TxnThreadLocal.
commute in interface TxnRef<E>function - the function to apply to this reference.
public final void commute(Txn tx,
Function<E> function)
TxnRefThis is different than the behavior in Clojure where the commute will be re-applied at the end of the txn, even though some dependency is introduced, which can lead to inconsistencies.
This call lifts on the Txn stored in the TxnThreadLocal.
commute in interface TxnRef<E>tx - the Txn used for this operation.function - the function to apply to this reference.
public final void commute(GammaTxn tx,
Function<E> function)
public final E atomicAlterAndGet(Function<E> function)
TxnRef
atomicAlterAndGet in interface TxnRef<E>function - the Function used
public final E atomicGetAndAlter(Function<E> function)
TxnRef
atomicGetAndAlter in interface TxnRef<E>function - the Function used
public final E alterAndGet(Function<E> function)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
alterAndGet in interface TxnRef<E>function - the function that alters the value stored in this Ref.
public final E alterAndGet(Txn tx,
Function<E> function)
TxnRef
alterAndGet in interface TxnRef<E>tx - the Txn used for this operation.function - the function that alters the value stored in this Ref.
public final E alterAndGet(GammaTxn tx,
Function<E> function)
public final E getAndAlter(Function<E> function)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
getAndAlter in interface TxnRef<E>function - the function that alters the value stored in this Ref.
public final E getAndAlter(Txn tx,
Function<E> function)
TxnRef
getAndAlter in interface TxnRef<E>tx - the Txn used for this operation.function - the function that alters the value stored in this Ref.
public final E getAndAlter(GammaTxn tx,
Function<E> function)
public final boolean atomicCompareAndSet(E expectedValue,
E newValue)
TxnRef
atomicCompareAndSet in interface TxnRef<E>expectedValue - the expected value.newValue - the new value.
public final boolean isNull()
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
isNull in interface TxnRef<E>public final boolean isNull(Txn tx)
TxnRef
isNull in interface TxnRef<E>tx - the Txn used for this operation.
public final boolean isNull(GammaTxn tx)
public final boolean atomicIsNull()
TxnRef
atomicIsNull in interface TxnRef<E>public final E awaitNotNullAndGet()
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
awaitNotNullAndGet in interface TxnRef<E>public final E awaitNotNullAndGet(Txn tx)
TxnRef
awaitNotNullAndGet in interface TxnRef<E>tx - the Txn used for this operation.
public final E awaitNotNullAndGet(GammaTxn tx)
public final void awaitNull()
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
awaitNull in interface TxnRef<E>public final void awaitNull(Txn tx)
TxnRef
awaitNull in interface TxnRef<E>tx - the Txn used for this operation.public final void awaitNull(GammaTxn tx)
public final void await(E value)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
await in interface TxnRef<E>value - the value to wait for.
public final void await(Txn tx,
E value)
TxnRef
await in interface TxnRef<E>tx - the Txn used for this operation.value - the value to wait for.
public final void await(GammaTxn tx,
E value)
public final void await(Predicate<E> predicate)
TxnRefThis call lifts on the Txn stored in the TxnThreadLocal.
await in interface TxnRef<E>predicate - the predicate to evaluate.
public final void await(Txn tx,
Predicate<E> predicate)
TxnRef
await in interface TxnRef<E>tx - the Txn used for this operation.predicate - the predicate to evaluate.
public final void await(GammaTxn tx,
Predicate<E> predicate)
public final String toDebugString()
TxnObject
toDebugString in interface TxnObjectpublic final String toString()
TxnObjectTxn on the TxnThreadLocal.
toString in interface TxnObjecttoString in class Objectpublic final String toString(Txn tx)
TxnObjectTxn.
toString in interface TxnObjecttx - the Txn used.
public final String toString(GammaTxn tx)
public final String atomicToString()
TxnObjectTxnThreadLocal. The outputted value doesn't need to be consistent from some point
in time, only a best effort is made.
atomicToString in interface TxnObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||