* negative, or checkBreaker is false, the breaker will be adjusted
* without tripping
*/
void adjustBreaker(long delta) {
if (this.breakerService != null) {
CircuitBreaker breaker = this.breakerService.getBreaker(CircuitBreaker.Name.REQUEST);
if (this.checkBreaker == true) {
// checking breaker means potentially tripping, but it doesn't
// have to if the delta is negative
if (delta > 0) {
try {
breaker.addEstimateBytesAndMaybeBreak(delta, "<reused_arrays>");
} catch (CircuitBreakingException e) {
// since we've already created the data, we need to
// add it so closing the stream re-adjusts properly
breaker.addWithoutBreaking(delta);
// re-throw the original exception
throw e;
}
} else {
breaker.addWithoutBreaking(delta);
}
} else {
// even if we are not checking the breaker, we need to adjust
// its' totals, so add without breaking
breaker.addWithoutBreaking(delta);
}
}
}