Class Subscriptions
java.lang.Object
org.jboss.resteasy.microprofile.client.publisher.Subscriptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longadd(long a, long b) Adds two long values and caps the sum at Long.MAX_VALUE.static longadd(AtomicLong requested, long requests) 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 longproduced(AtomicLong requested, long amount) Concurrent subtraction bound to 0, mostly used to decrement a request tracker by the amount produced by the operator.static longsubOrZero(long a, long b) Cap a subtraction to 0
-
Constructor Details
-
Subscriptions
public Subscriptions()
-
-
Method Details
-
add
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.- Parameters:
requested- the AtomicLong holding the current requested valuerequests- the value to add, must be positive (not verified)- Returns:
- the original value before the add
-
add
public static long add(long a, long b) Adds two long values and caps the sum at Long.MAX_VALUE.- Parameters:
a- the first valueb- the second value- Returns:
- the sum capped at Long.MAX_VALUE
-
produced
Concurrent subtraction bound to 0, mostly used to decrement a request tracker by the amount produced by the operator.- Parameters:
requested- the atomic long keeping track of requestsamount- delta to subtract- Returns:
- value after subtraction or zero
-
subOrZero
public static long subOrZero(long a, long b) Cap a subtraction to 0- Parameters:
a- left operandb- right operand- Returns:
- Subtraction result or 0 if overflow
-