class AtomicLong extends Number with Serializable
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- AtomicLong
- Number
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def accumulateAndGet(x: Long, accumulatorFunction: LongBinaryOperator): Long
Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function to the current and given values, returning the updated value.Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function to the current and given values, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.- x
the update value
- accumulatorFunction
a side-effect-free function of two arguments
- returns
the updated value
- Since
1.8
- final def addAndGet(delta: Long): Long
Atomically adds the given value to the current value, with memory effects as specified by
VarHandle#getAndAdd
.Atomically adds the given value to the current value, with memory effects as specified by
VarHandle#getAndAdd
.- delta
the value to add
- returns
the updated value
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def byteValue(): Byte
- Definition Classes
- Number
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def compareAndExchange(expectedValue: Long, newValue: Long): Long
Atomically sets the value to
newValue
if the current value, referred to as the witness value,== expectedValue
, with memory effects as specified byVarHandle#compareAndExchange
.Atomically sets the value to
newValue
if the current value, referred to as the witness value,== expectedValue
, with memory effects as specified byVarHandle#compareAndExchange
.- expectedValue
the expected value
- newValue
the new value
- returns
the witness value, which will be the same as the expected value if successful
- Since
9
- final def compareAndExchangeAcquire(expectedValue: Long, newValue: Long): Long
Atomically sets the value to
newValue
if the current value, referred to as the witness value,== expectedValue
, with memory effects as specified byVarHandle#compareAndExchangeAcquire
.Atomically sets the value to
newValue
if the current value, referred to as the witness value,== expectedValue
, with memory effects as specified byVarHandle#compareAndExchangeAcquire
.- expectedValue
the expected value
- newValue
the new value
- returns
the witness value, which will be the same as the expected value if successful
- Since
9
- final def compareAndExchangeRelease(expectedValue: Long, newValue: Long): Long
Atomically sets the value to
newValue
if the current value, referred to as the witness value,== expectedValue
, with memory effects as specified byVarHandle#compareAndExchangeRelease
.Atomically sets the value to
newValue
if the current value, referred to as the witness value,== expectedValue
, with memory effects as specified byVarHandle#compareAndExchangeRelease
.- expectedValue
the expected value
- newValue
the new value
- returns
the witness value, which will be the same as the expected value if successful
- Since
9
- final def compareAndSet(expectedValue: Long, newValue: Long): Boolean
Atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#compareAndSet
.Atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#compareAndSet
.- expectedValue
the expected value
- newValue
the new value
- returns
true
if successful. False return indicates that the actual value was not equal to the expected value.
- final def decrementAndGet(): Long
Atomically decrements the current value, with memory effects as specified by
VarHandle#getAndAdd
.Atomically decrements the current value, with memory effects as specified by
VarHandle#getAndAdd
.Equivalent to
addAndGet(-1)
.- returns
the updated value
- def doubleValue(): Double
Returns the current value of this
AtomicInteger
as adouble
after a widening primitive conversion, with memory effects as specified byVarHandle#getVolatile
.Returns the current value of this
AtomicInteger
as adouble
after a widening primitive conversion, with memory effects as specified byVarHandle#getVolatile
.- Definition Classes
- AtomicLong → Number
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def floatValue(): Float
Returns the current value of this
AtomicInteger
as afloat
after a widening primitive conversion, with memory effects as specified byVarHandle#getVolatile
.Returns the current value of this
AtomicInteger
as afloat
after a widening primitive conversion, with memory effects as specified byVarHandle#getVolatile
.- Definition Classes
- AtomicLong → Number
- final def get(): Long
Returns the current value, with memory effects as specified by
VarHandle#getVolatile
.Returns the current value, with memory effects as specified by
VarHandle#getVolatile
.- returns
the current value
- final def getAcquire: Long
Returns the current value, with memory effects as specified by
VarHandle#getAcquire
.Returns the current value, with memory effects as specified by
VarHandle#getAcquire
.- returns
the value
- Since
9
- final def getAndAccumulate(x: Long, accumulatorFunction: LongBinaryOperator): Long
Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function to the current and given values, returning the previous value.Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function to the current and given values, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.- x
the update value
- accumulatorFunction
a side-effect-free function of two arguments
- returns
the previous value
- Since
1.8
- final def getAndAdd(delta: Long): Long
Atomically adds the given value to the current value, with memory effects as specified by
VarHandle#getAndAdd
.Atomically adds the given value to the current value, with memory effects as specified by
VarHandle#getAndAdd
.- delta
the value to add
- returns
the previous value
- final def getAndDecrement(): Long
Atomically decrements the current value, with memory effects as specified by
VarHandle#getAndAdd
.Atomically decrements the current value, with memory effects as specified by
VarHandle#getAndAdd
.Equivalent to
getAndAdd(-1)
.- returns
the previous value
- final def getAndIncrement(): Long
Atomically increments the current value, with memory effects as specified by
VarHandle#getAndAdd
.Atomically increments the current value, with memory effects as specified by
VarHandle#getAndAdd
.Equivalent to
getAndAdd(1)
.- returns
the previous value
- final def getAndSet(newValue: Long): Long
Atomically sets the value to
newValue
and returns the old value, with memory effects as specified byVarHandle#getAndSet
.Atomically sets the value to
newValue
and returns the old value, with memory effects as specified byVarHandle#getAndSet
.- newValue
the new value
- returns
the previous value
- final def getAndUpdate(updateFunction: LongUnaryOperator): Long
Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function, returning the previous value.Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.- updateFunction
a side-effect-free function
- returns
the previous value
- Since
1.8
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def getOpaque(): Long
Returns the current value, with memory effects as specified by
VarHandle#getOpaque
.Returns the current value, with memory effects as specified by
VarHandle#getOpaque
.- returns
the value
- Since
9
- final def getPlain(): Long
Returns the current value, with memory semantics of reading as if the variable was declared non-
volatile
.Returns the current value, with memory semantics of reading as if the variable was declared non-
volatile
.- returns
the value
- Since
9
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def incrementAndGet(): Long
Atomically increments the current value, with memory effects as specified by
VarHandle#getAndAdd
.Atomically increments the current value, with memory effects as specified by
VarHandle#getAndAdd
.Equivalent to
addAndGet(1)
.- returns
the updated value
- def intValue(): Int
Returns the current value of this
AtomicInteger
as anint
, with memory effects as specified byVarHandle#getVolatile
.Returns the current value of this
AtomicInteger
as anint
, with memory effects as specified byVarHandle#getVolatile
.Equivalent to
( )
.- Definition Classes
- AtomicLong → Number
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def lazySet(newValue: Long): Unit
Sets the value to
newValue
, with memory effects as specified byVarHandle#setRelease
.Sets the value to
newValue
, with memory effects as specified byVarHandle#setRelease
.- newValue
the new value
- Since
1.6
- def longValue(): Long
Returns the current value of this
AtomicInteger
as along
after a widening primitive conversion, with memory effects as specified byVarHandle#getVolatile
.Returns the current value of this
AtomicInteger
as along
after a widening primitive conversion, with memory effects as specified byVarHandle#getVolatile
.- Definition Classes
- AtomicLong → Number
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def set(newValue: Long): Unit
Sets the value to
newValue
, with memory effects as specified byVarHandle#setVolatile
.Sets the value to
newValue
, with memory effects as specified byVarHandle#setVolatile
.- newValue
the new value
- final def setOpaque(newValue: Long): Unit
Sets the value to
newValue
, with memory effects as specified byVarHandle#setOpaque
.Sets the value to
newValue
, with memory effects as specified byVarHandle#setOpaque
.- newValue
the new value
- Since
9
- final def setPlain(newValue: Long): Unit
Sets the value to
newValue
, with memory semantics of setting as if the variable was declared non-volatile
and non-final
.Sets the value to
newValue
, with memory semantics of setting as if the variable was declared non-volatile
and non-final
.- newValue
the new value
- Since
9
- final def setRelease(newValue: Long): Unit
Sets the value to
newValue
, with memory effects as specified byVarHandle#setRelease
.Sets the value to
newValue
, with memory effects as specified byVarHandle#setRelease
.- newValue
the new value
- Since
9
- def shortValue(): Short
- Definition Classes
- Number
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
Returns the String representation of the current value.
Returns the String representation of the current value.
- returns
the String representation of the current value
- Definition Classes
- AtomicLong → AnyRef → Any
- final def updateAndGet(updateFunction: LongUnaryOperator): Long
Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function, returning the updated value.Atomically updates (with memory effects as specified by
VarHandle#compareAndSet
) the current value with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.- updateFunction
a side-effect-free function
- returns
the updated value
- Since
1.8
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def weakCompareAndSetAcquire(expectedValue: Long, newValue: Long): Boolean
Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetAcquire
.Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetAcquire
.- expectedValue
the expected value
- newValue
the new value
- returns
true
if successful
- Since
9
- final def weakCompareAndSetPlain(expectedValue: Long, newValue: Long): Boolean
Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetPlain
.Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetPlain
.- expectedValue
the expected value
- newValue
the new value
- returns
true
if successful
- Since
9
- final def weakCompareAndSetRelease(expectedValue: Long, newValue: Long): Boolean
Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetRelease
.Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetRelease
.- expectedValue
the expected value
- newValue
the new value
- returns
true
if successful
- Since
9
- final def weakCompareAndSetVolatile(expectedValue: Long, newValue: Long): Boolean
Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSet
.Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSet
.- expectedValue
the expected value
- newValue
the new value
- returns
true
if successful
- Since
9
Deprecated Value Members
- final def weakCompareAndSet(expectedValue: Long, newValue: Long): Boolean
Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetPlain
.Possibly atomically sets the value to
newValue
if the current value== expectedValue
, with memory effects as specified byVarHandle#weakCompareAndSetPlain
.- expectedValue
the expected value
- newValue
the new value
- returns
true
if successful
- Annotations
- @deprecated
- Deprecated
(Since version 9)
- See also
#weakCompareAndSetPlain