public final class BackpressureUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static long |
addCap(long a, long b)
Adds two positive longs and caps the result at Long.MAX_VALUE.
|
static <T> long |
getAndAddRequest(AtomicLongFieldUpdater
Adds
n to
requested field and returns the value prior to addition once the addition is successful (uses CAS semantics).
|
static long |
getAndAddRequest(AtomicLong
Adds
n to
requested and returns the value prior to addition once the addition is successful (uses CAS semantics).
|
static long |
multiplyCap(long a, long b)
Multiplies two positive longs and caps the result at Long.MAX_VALUE.
|
public static <T> long getAndAddRequest(AtomicLongFieldUpdater<T> requested, T object, long n)
n to
requested field and returns the value prior to addition once the addition is successful (uses CAS semantics). If overflows then sets
requested field to
Long.MAX_VALUE.
requested - atomic field updater for a request count
object - contains the field updated by the updater
n - the number of requests to add to the requested count
public static long getAndAddRequest(AtomicLongrequested, long n)
n to
requested and returns the value prior to addition once the addition is successful (uses CAS semantics). If overflows then sets
requested field to
Long.MAX_VALUE.
requested - atomic long that should be updated
n - the number of requests to add to the requested count
public static long multiplyCap(long a,
long b)
a - the first value
b - the second value
public static long addCap(long a,
long b)
a - the first value
b - the second value