public final class BackpressureHelper extends Object
Modifier and Type | Method and Description |
---|---|
static long |
add(AtomicLong requested,
long n)
Atomically adds the positive value n to the requested value in the AtomicLong and
caps the result at Long.MAX_VALUE and returns the previous value.
|
static long |
addCancel(AtomicLong requested,
long n)
Atomically adds the positive value n to the requested value in the AtomicLong and
caps the result at Long.MAX_VALUE and returns the previous value and
considers Long.MIN_VALUE as a cancel indication (no addition then).
|
static long |
addCap(long a,
long b)
Adds two long values and caps the sum at Long.MAX_VALUE.
|
static long |
multiplyCap(long a,
long b)
Multiplies two long values and caps the product at Long.MAX_VALUE.
|
static long |
produced(AtomicLong requested,
long n)
Atomically subtract the given number (positive, not validated) from the target field unless it contains Long.MAX_VALUE.
|
static long |
producedCancel(AtomicLong requested,
long n)
Atomically subtract the given number (positive, not validated) from the target field if
it doesn't contain Long.MIN_VALUE (indicating some cancelled state) or Long.MAX_VALUE (unbounded mode).
|
public static long addCap(long a, long b)
a
- the first valueb
- the second valuepublic static long multiplyCap(long a, long b)
a
- the first valueb
- the second valuepublic static long add(AtomicLong requested, long n)
requested
- the AtomicLong holding the current requested valuen
- the value to add, must be positive (not verified)public static long addCancel(AtomicLong requested, long n)
requested
- the AtomicLong holding the current requested valuen
- the value to add, must be positive (not verified)public static long produced(AtomicLong requested, long n)
requested
- the target field holding the current requested amountn
- the produced element count, positive (not validated)public static long producedCancel(AtomicLong requested, long n)
requested
- the target field holding the current requested amountn
- the produced element count, positive (not validated)Copyright © 2018 JBoss by Red Hat. All rights reserved.