HBASE-13188 java.lang.ArithmeticException issue in BoundedByteBufferPool.putBuffer

This commit is contained in:
stack 2015-03-10 08:42:32 -07:00
parent eb2193afa0
commit 78d6a3402c
1 changed files with 4 additions and 1 deletions

View File

@ -101,7 +101,10 @@ public class BoundedByteBufferPool {
} else { } else {
int size = this.buffers.size(); // This size may be inexact. int size = this.buffers.size(); // This size may be inexact.
this.totalReservoirCapacity += bb.capacity(); this.totalReservoirCapacity += bb.capacity();
int average = this.totalReservoirCapacity / size; int average = 0;
if (size != 0) {
average = this.totalReservoirCapacity / size;
}
if (average > this.runningAverage && average < this.maxByteBufferSizeToCache) { if (average > this.runningAverage && average < this.maxByteBufferSizeToCache) {
this.runningAverage = average; this.runningAverage = average;
} }