RecentEstimatedHistogram: Support empty histogram

The RecentEstimatedHistogram updates its value from the API with an
array of recent values.

This array can be empty, in that case the getBuckets method should just
return a zero size array.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This commit is contained in:
Amnon Heiman 2015-11-19 11:55:34 +02:00
parent e0dea0c27e
commit 695e23bd4e

View File

@ -50,6 +50,9 @@ public class RecentEstimatedHistogram extends EstimatedHistogram {
* @return a long[] containing the current histogram difference buckets
*/
public long[] getBuckets(long[] bucketData) {
if (bucketData.length == 0) {
return new long[0];
}
final int len = buckets.length();
long[] rv = new long[len];