public class RequestedCounter extends Object
Flow.Subscribers.| Constructor and Description |
|---|
RequestedCounter() |
| Modifier and Type | Method and Description |
|---|---|
long |
get()
Gets the current requested event counter value.
|
void |
increment(long increment,
Consumer<? super IllegalArgumentException> errorHandler)
Increments safely a requested event counter to prevent
Long.MAX_VALUE overflow. |
boolean |
tryDecrement()
Tries to safely decrement a positive requested counter value, making sure the value does not drop below zero.
|
public void increment(long increment,
Consumer<? super IllegalArgumentException> errorHandler)
Long.MAX_VALUE overflow.increment - amount of additional events to request.errorHandler - a consumer of IllegalArgumentException to
process errorspublic boolean tryDecrement()
true if the initial positive value has been decremented successfully, false in case the initial
counter value was already set to zero.public long get()
Copyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.