public final class BackpressureUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> long |
getAndAddRequest(AtomicLongFieldUpdater<T> requested,
T object,
long n)
Adds
n to requested field and returns the value prior to
addition once the addition is successful (uses CAS semantics). |
static long |
getAndAddRequest(AtomicLong requested,
long n)
Adds
n to requested and returns the value prior to
addition once the addition is successful (uses CAS semantics). |
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
.T
- then type of the volatile being updatedrequested
- atomic field updater for a request countobject
- contains the field updated by the updatern
- the number of requests to add to the requested countpublic static long getAndAddRequest(AtomicLong requested, 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 field updater for a request countn
- the number of requests to add to the requested countCopyright © 2013–2016. All rights reserved.