public static class BTraceUtils.Atomic
extends java.lang.Object
Constructor and Description |
---|
BTraceUtils.Atomic() |
Modifier and Type | Method and Description |
---|---|
static int |
addAndGet(java.util.concurrent.atomic.AtomicInteger ai,
int delta)
Atomically adds the given value to the current value.
|
static long |
addAndGet(java.util.concurrent.atomic.AtomicLong al,
long delta)
Atomically adds the given value to the current value.
|
static boolean |
compareAndSet(java.util.concurrent.atomic.AtomicInteger ai,
int expect,
int update)
Atomically sets the value of given AtomitInteger to the given
updated value if the current value
== the expected value. |
static boolean |
compareAndSet(java.util.concurrent.atomic.AtomicLong al,
long expect,
long update)
Atomically sets the value to the given updated value
if the current value
== the expected value. |
static int |
decrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
Atomically decrements by one the current value of given AtomicInteger.
|
static long |
decrementAndGet(java.util.concurrent.atomic.AtomicLong al)
Atomically decrements by one the current value.
|
static int |
get(java.util.concurrent.atomic.AtomicInteger ai)
Gets the current value of the given AtomicInteger.
|
static long |
get(java.util.concurrent.atomic.AtomicLong al)
Gets the current value the given AtomicLong.
|
static int |
getAndAdd(java.util.concurrent.atomic.AtomicInteger ai,
int delta)
Atomically adds the given value to the current value.
|
static long |
getAndAdd(java.util.concurrent.atomic.AtomicLong al,
long delta)
Atomically adds the given value to the current value.
|
static int |
getAndDecrement(java.util.concurrent.atomic.AtomicInteger ai)
Atomically decrements by one the current value of given AtomicInteger.
|
static long |
getAndDecrement(java.util.concurrent.atomic.AtomicLong al)
Atomically decrements by one the current value.
|
static int |
getAndIncrement(java.util.concurrent.atomic.AtomicInteger ai)
Atomically increments by one the current value of given AtomicInteger.
|
static long |
getAndIncrement(java.util.concurrent.atomic.AtomicLong al)
Atomically increments by one the current value.
|
static int |
getAndSet(java.util.concurrent.atomic.AtomicInteger ai,
int newValue)
Atomically sets to the given value and returns the old value.
|
static long |
getAndSet(java.util.concurrent.atomic.AtomicLong al,
long newValue)
Atomically sets to the given value and returns the old value.
|
static int |
incrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
Atomically increments by one the current value of given AtomicInteger.
|
static long |
incrementAndGet(java.util.concurrent.atomic.AtomicLong al)
Atomically increments by one the current value.
|
static void |
lazySet(java.util.concurrent.atomic.AtomicInteger ai,
int newValue)
Eventually sets to the given value to the given AtomicInteger.
|
static void |
lazySet(java.util.concurrent.atomic.AtomicLong al,
long newValue)
Eventually sets to the given value to the given AtomicLong.
|
static java.util.concurrent.atomic.AtomicInteger |
newAtomicInteger(int initialValue)
Creates a new AtomicInteger with the given initial value.
|
static java.util.concurrent.atomic.AtomicLong |
newAtomicLong(long initialValue)
Creates a new AtomicLong with the given initial value.
|
static void |
set(java.util.concurrent.atomic.AtomicInteger ai,
int newValue)
Sets to the given value to the given AtomicInteger.
|
static void |
set(java.util.concurrent.atomic.AtomicLong al,
long newValue)
Sets to the given value.
|
static boolean |
weakCompareAndSet(java.util.concurrent.atomic.AtomicInteger ai,
int expect,
int update)
Atomically sets the value to the given updated value
if the current value
== the expected value. |
static boolean |
weakCompareAndSet(java.util.concurrent.atomic.AtomicLong al,
long expect,
long update)
Atomically sets the value to the given updated value
if the current value
== the expected value. |
public static java.util.concurrent.atomic.AtomicInteger newAtomicInteger(int initialValue)
initialValue
- the initial valuepublic static int get(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger whose value is returned.public static void set(java.util.concurrent.atomic.AtomicInteger ai, int newValue)
ai
- AtomicInteger whose value is set.newValue
- the new valuepublic static void lazySet(java.util.concurrent.atomic.AtomicInteger ai, int newValue)
ai
- AtomicInteger whose value is lazily set.newValue
- the new valuepublic static boolean compareAndSet(java.util.concurrent.atomic.AtomicInteger ai, int expect, int update)
==
the expected value.ai
- AtomicInteger whose value is compared and set.expect
- the expected valueupdate
- the new valuepublic static boolean weakCompareAndSet(java.util.concurrent.atomic.AtomicInteger ai, int expect, int update)
==
the expected value.
May fail spuriously
and does not provide ordering guarantees, so is only rarely an
appropriate alternative to compareAndSet
.
ai
- AtomicInteger whose value is weakly compared and set.expect
- the expected valueupdate
- the new valuepublic static int getAndIncrement(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger that is incremented.public static int getAndDecrement(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger that is decremented.public static int incrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger that is incremented.public static int decrementAndGet(java.util.concurrent.atomic.AtomicInteger ai)
ai
- AtomicInteger whose value is decremented.public static int getAndAdd(java.util.concurrent.atomic.AtomicInteger ai, int delta)
ai
- AtomicInteger whose value is added to.delta
- the value to addpublic static int addAndGet(java.util.concurrent.atomic.AtomicInteger ai, int delta)
ai
- AtomicInteger whose value is added to.delta
- the value to addpublic static int getAndSet(java.util.concurrent.atomic.AtomicInteger ai, int newValue)
ai
- AtomicInteger whose value is set.newValue
- the new valuepublic static java.util.concurrent.atomic.AtomicLong newAtomicLong(long initialValue)
initialValue
- the initial valuepublic static long get(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is returned.public static void set(java.util.concurrent.atomic.AtomicLong al, long newValue)
al
- AtomicLong whose value is set.newValue
- the new valuepublic static void lazySet(java.util.concurrent.atomic.AtomicLong al, long newValue)
al
- AtomicLong whose value is set.newValue
- the new valuepublic static boolean compareAndSet(java.util.concurrent.atomic.AtomicLong al, long expect, long update)
==
the expected value.al
- AtomicLong whose value is compared and set.expect
- the expected valueupdate
- the new valuepublic static boolean weakCompareAndSet(java.util.concurrent.atomic.AtomicLong al, long expect, long update)
==
the expected value.
May fail spuriously
and does not provide ordering guarantees, so is only rarely an
appropriate alternative to compareAndSet
.
al
- AtomicLong whose value is compared and set.expect
- the expected valueupdate
- the new valuepublic static long getAndIncrement(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is incremented.public static long getAndDecrement(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is decremented.public static long incrementAndGet(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is incremented.public static long decrementAndGet(java.util.concurrent.atomic.AtomicLong al)
al
- AtomicLong whose value is decremented.public static long getAndAdd(java.util.concurrent.atomic.AtomicLong al, long delta)
al
- AtomicLong whose value is added to.delta
- the value to addpublic static long addAndGet(java.util.concurrent.atomic.AtomicLong al, long delta)
al
- AtomicLong whose value is added todelta
- the value to addpublic static long getAndSet(java.util.concurrent.atomic.AtomicLong al, long newValue)
al
- AtomicLong that is set.newValue
- the new value