codahale/metrics — pull request #477 by rwmccro (2013-10-20 00:14:38+00:00)
Title: SlidingWindowReservoir - ArrayOutOfBoundsException thrown if # of Reservoir examples exceeds Integer max value.

Running a Histogram backed by a SlidingWindowReservoir, if I let the server process run long enough, the Histogram eventually fails with the following:

java.lang.ArrayIndexOutOfBoundsException: -3647
at com.codahale.metrics.SlidingWindowReservoir.update(SlidingWindowReservoir.java:30) ~[metrics-core-3.0.1.jar:3.0.1]
at com.codahale.metrics.Histogram.update(Histogram.java:39) ~[metrics-core-3.0.1.jar:3.0.1]
at com.codahale.metrics.Histogram.update(Histogram.java:29) ~[metrics-core-3.0.1.jar:3.0.1]

This appears related to converting the count being kept within the Reservoir object to an Integer prior to the modulo operation to identify the measurement to update/replace.