public class GammaTxnDouble extends BaseGammaTxnRef implements TxnDouble
long_value, ref_value, type
___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
FAILURE, MASK_CONFLICT, MASK_SUCCESS, MASK_UNREGISTERED, REGISTRATION_DONE, REGISTRATION_NONE, REGISTRATION_NOT_NEEDED, TRANLOCAL_COMMUTING, TRANLOCAL_CONSTRUCTING, TRANLOCAL_READ, TRANLOCAL_WRITE, TRANSACTIONTYPE_FAT_FIXED_LENGTH, TRANSACTIONTYPE_FAT_MONO, TRANSACTIONTYPE_FAT_VARIABLE_LENGTH, TRANSACTIONTYPE_LEAN_FIXED_LENGTH, TRANSACTIONTYPE_LEAN_MONO, TX_ABORTED, TX_ACTIVE, TX_COMMITTED, TX_PREPARED, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_INT, TYPE_LONG, TYPE_REF, VERSION_UNCOMMITTED
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED
Constructor and Description |
---|
GammaTxnDouble(double value) |
GammaTxnDouble(GammaStm stm) |
GammaTxnDouble(GammaStm stm,
double value) |
GammaTxnDouble(GammaTxn tx) |
GammaTxnDouble(GammaTxn tx,
double value) |
Modifier and Type | Method and Description |
---|---|
double |
alter(GammaTxn tx,
DoubleFunction function,
boolean returnOld) |
double |
alterAndGet(DoubleFunction function)
Alters the value stored in this Ref using the provided function and returns the result.
|
double |
alterAndGet(GammaTxn tx,
DoubleFunction function) |
double |
alterAndGet(Txn tx,
DoubleFunction function)
Alters the value stored in this Ref using the provided function and lifting on the provided txn.
|
double |
atomicAlterAndGet(DoubleFunction function)
Atomically applies the function to the current value in this ref and returns the new value.
|
boolean |
atomicCompareAndSet(double expectedValue,
double newValue)
Executes a compare and set atomically.
|
double |
atomicGet()
Atomically gets the value.
|
double |
atomicGetAndAlter(DoubleFunction function)
Atomically applies the function to alter the value stored in this ref and returns the old value.
|
double |
atomicGetAndIncrement(double amount)
Atomically increments the value and returns the old value.
|
double |
atomicGetAndSet(double newValue)
Atomically sets the value and returns the previous value.
|
double |
atomicIncrementAndGet(double amount)
Atomically increments the value and returns the old value.
|
double |
atomicSet(double 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 . |
double |
atomicWeakGet()
Atomically gets the value without providing any ordering guarantees.
|
void |
await(double value)
Awaits for the value to become the given value.
|
void |
await(DoublePredicate predicate)
Awaits until the predicate holds.
|
void |
await(GammaTxn tx,
double value) |
void |
await(GammaTxn tx,
DoublePredicate predicate) |
void |
await(Txn tx,
double value)
Awaits for the reference to become the given value.
|
void |
await(Txn tx,
DoublePredicate predicate)
Awaits until the predicate holds using the provided txn.
|
void |
commute(DoubleFunction function)
Applies the function on the ref in a commuting manner.
|
void |
commute(GammaTxn tx,
DoubleFunction function) |
void |
commute(Txn tx,
DoubleFunction function)
Applies the function on the ref in a commuting manner.
|
double |
get()
Gets the value using the provided txn.
|
double |
get(GammaTxn tx) |
double |
get(Txn tx)
Gets the value using the provided txn.
|
double |
getAndAlter(DoubleFunction function)
Alters the value stored in this Ref using the provided function amd returns the old value.
|
double |
getAndAlter(GammaTxn tx,
DoubleFunction function) |
double |
getAndAlter(Txn tx,
DoubleFunction function)
Alters the value stored in this Ref using the function and returns the old value, using the provided txn.
|
double |
getAndIncrement(double amount)
Increments the value and returns the old value.
|
double |
getAndIncrement(GammaTxn tx,
double amount) |
double |
getAndIncrement(Txn tx,
double amount)
Increments the value and returns the old value using the provided txn.
|
double |
getAndLock(GammaTxn tx,
LockMode lockMode) |
double |
getAndLock(LockMode lockMode)
Gets the value and applies the lock.
|
double |
getAndLock(Txn tx,
LockMode lockMode)
Gets the value using the provided txn and acquired the lock with the specified LockMode.
|
double |
getAndSet(double value)
Sets the value the value and returns the new value.
|
double |
getAndSet(GammaTxn tx,
double value) |
double |
getAndSet(Txn tx,
double value)
Sets the value using the provided txn.
|
double |
getAndSetAndLock(double value,
LockMode lockMode)
Sets the value, acquired the Lock with the specified Lockmode and returns the previous value.
|
double |
getAndSetAndLock(GammaTxn tx,
double value,
LockMode lockMode) |
double |
getAndSetAndLock(Txn tx,
double value,
LockMode lockMode)
Sets the value and acquired the Lock with the provided LockMode.
|
double |
incrementAndGet(double amount)
Increments and gets the new value.
|
double |
incrementAndGet(GammaTxn tx,
double amount) |
double |
incrementAndGet(Txn tx,
double amount)
Increments and gets the new value using the provided txn.
|
double |
set(double value)
Sets the new value.
|
double |
set(GammaTxn tx,
double value) |
double |
set(Txn tx,
double value)
Sets the new value using the provided txn.
|
double |
setAndLock(double value,
LockMode lockMode)
Sets the new value and applies the lock.
|
double |
setAndLock(GammaTxn tx,
double value,
LockMode lockMode) |
double |
setAndLock(Txn tx,
double 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 . |
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
___removeListenersAfterWrite, ___toOrecString, arrive, arriveAndExclusiveLock, arriveAndLock, atomicGetLockMode, atomicGetLockModeAsInt, departAfterFailure, departAfterFailureAndUnlock, departAfterReading, departAfterReadingAndUnlock, departAfterUpdateAndUnlock, getLock, getLockMode, getLockMode, getLockMode, getReadBiasedThreshold, getReadLockCount, getReadLockCount, getReadonlyCount, getReadonlyCount, getStm, getSurplus, getSurplus, getVersion, hasAnyLock, hasExclusiveLock, hasExclusiveLock, hasWriteLock, hasWriteLock, hasWriteOrExclusiveLock, identityHashCode, isReadBiased, isReadBiased, lockAfterArrive, setExclusiveLock, setIsReadBiased, setReadLockCount, setReadonlyCount, setSurplus, setWriteLock, unlockByUnregistered, upgradeReadLock, upgradeWriteLock, waitForExclusiveLockToBecomeFree
public GammaTxnDouble(double value)
public GammaTxnDouble(GammaTxn tx)
public GammaTxnDouble(GammaTxn tx, double value)
public GammaTxnDouble(GammaStm stm)
public GammaTxnDouble(GammaStm stm, double value)
public final double get()
TxnDouble
get
in interface TxnDouble
TxnDouble.atomicGet()
public final double get(Txn tx)
TxnDouble
public final double get(GammaTxn tx)
public final double getAndLock(LockMode lockMode)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndLock
in interface TxnDouble
lockMode
- the LockMode applied.TxnDouble.atomicGet()
public final double getAndLock(Txn tx, LockMode lockMode)
TxnDouble
getAndLock
in interface TxnDouble
tx
- the Txn
used for this operation.lockMode
- the LockMode usedpublic final double set(double value)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
public final double set(Txn tx, double value)
TxnDouble
public final double set(GammaTxn tx, double value)
public final double setAndLock(double value, LockMode lockMode)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
setAndLock
in interface TxnDouble
value
- the new value.lockMode
- the used LockMode.public final double setAndLock(Txn tx, double value, LockMode lockMode)
TxnDouble
setAndLock
in interface TxnDouble
tx
- the Txn
used for this operation.value
- the new valuelockMode
- the lockMode used.public final double getAndSet(double value)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
public final double getAndSet(Txn tx, double value)
TxnDouble
public final double getAndSet(GammaTxn tx, double value)
public final double getAndSetAndLock(double value, LockMode lockMode)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndSetAndLock
in interface TxnDouble
value
- the new value.lockMode
- the LockMode used.public final double getAndSetAndLock(Txn tx, double value, LockMode lockMode)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndSetAndLock
in interface TxnDouble
tx
- the Txn
used for this operation.value
- the new value.lockMode
- the LockMode used.public final double atomicGet()
TxnDouble
TxnDouble.atomicWeakGet()
.public final double atomicWeakGet()
TxnDouble
It is the best method to call if you just want to get the current value stored.
atomicWeakGet
in interface TxnDouble
public final double atomicSet(double newValue)
TxnDouble
public final double atomicGetAndSet(double newValue)
TxnDouble
atomicGetAndSet
in interface TxnDouble
newValue
- the new value.public final void commute(DoubleFunction function)
TxnDouble
This 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
.
public final void commute(Txn tx, DoubleFunction function)
TxnDouble
This 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
.
public final void commute(GammaTxn tx, DoubleFunction function)
public final double atomicAlterAndGet(DoubleFunction function)
TxnDouble
atomicAlterAndGet
in interface TxnDouble
function
- the Function usedpublic final double atomicGetAndAlter(DoubleFunction function)
TxnDouble
atomicGetAndAlter
in interface TxnDouble
function
- the Function usedpublic final double alterAndGet(DoubleFunction function)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
alterAndGet
in interface TxnDouble
function
- the function that alters the value stored in this Ref.public final double alterAndGet(Txn tx, DoubleFunction function)
TxnDouble
alterAndGet
in interface TxnDouble
tx
- the Txn
used for this operation.function
- the function that alters the value stored in this Ref.public final double alterAndGet(GammaTxn tx, DoubleFunction function)
public final double getAndAlter(DoubleFunction function)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndAlter
in interface TxnDouble
function
- the function that alters the value stored in this Ref.public final double getAndAlter(Txn tx, DoubleFunction function)
TxnDouble
getAndAlter
in interface TxnDouble
tx
- the Txn
used for this operation.function
- the function that alters the value stored in this Ref.public final double getAndAlter(GammaTxn tx, DoubleFunction function)
public final double alter(GammaTxn tx, DoubleFunction function, boolean returnOld)
public final boolean atomicCompareAndSet(double expectedValue, double newValue)
TxnDouble
atomicCompareAndSet
in interface TxnDouble
expectedValue
- the expected value.newValue
- the new value.public final double getAndIncrement(double amount)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndIncrement
in interface TxnDouble
amount
- the amount to increment with.public final double getAndIncrement(Txn tx, double amount)
TxnDouble
getAndIncrement
in interface TxnDouble
tx
- the Txn
used for this operation.amount
- the amount to increment with.public final double getAndIncrement(GammaTxn tx, double amount)
public final double atomicGetAndIncrement(double amount)
TxnDouble
atomicGetAndIncrement
in interface TxnDouble
amount
- the amount to increase with.public final double atomicIncrementAndGet(double amount)
TxnDouble
atomicIncrementAndGet
in interface TxnDouble
amount
- the amount to increment with.public final double incrementAndGet(double amount)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
incrementAndGet
in interface TxnDouble
amount
- the amount to increment with.public final double incrementAndGet(Txn tx, double amount)
TxnDouble
incrementAndGet
in interface TxnDouble
tx
- the Txn
used for this operation.amount
- the amount to increment with.public final double incrementAndGet(GammaTxn tx, double amount)
public final void await(double value)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
public final void await(Txn tx, double value)
TxnDouble
public final void await(GammaTxn tx, double value)
public final void await(DoublePredicate predicate)
TxnDouble
This call lifts on the Txn
stored in the TxnThreadLocal
.
public final void await(Txn tx, DoublePredicate predicate)
TxnDouble
public final void await(GammaTxn tx, DoublePredicate predicate)
public final String toDebugString()
TxnObject
toDebugString
in interface TxnObject
public final String toString()
TxnObject
Txn
on the TxnThreadLocal
.public final String toString(Txn tx)
TxnObject
Txn
.public final String atomicToString()
TxnObject
TxnThreadLocal
. The outputted value doesn't need to be consistent from some point
in time, only a best effort is made.atomicToString
in interface TxnObject
Copyright © 2020. All rights reserved.