michaeljmarshall commented on a change in pull request #13993:
URL: https://github.com/apache/pulsar/pull/13993#discussion_r794199365
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/Backoff.java
##########
@@ -84,19 +121,30 @@ public long next() {
return Math.max(initial, current);
}
- public void reduceToHalf() {
+ /**
+ * Reduce the next backoff to half of its current value. If the result is
less than {@link #initial}, set
+ * {@link #next} to {@link #initial}.
+ */
+ public synchronized void reduceToHalf() {
if (next > initial) {
this.next = Math.max(this.next / 2, this.initial);
}
}
- public void reset() {
+ /**
+ * Reset this {@link Backoff} instance to its initial state.
+ */
+ public synchronized void reset() {
this.next = this.initial;
this.mandatoryStopMade = false;
}
+ public synchronized boolean isMandatoryStopMade() {
Review comment:
We either need to synchronize it or make the variable volatile. Since it
is only used in one place (and is possibly used incorrectly), I lean towards
making it synchronized, for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]