HADOOP-15023. ValueQueue should also validate (int) (lowWatermark * numValues) > 0 on construction.
(cherry picked from commit b1941b200d
)
This commit is contained in:
parent
9780d58a63
commit
a78dbd1571
|
@ -224,6 +224,9 @@ public class ValueQueue <E> {
|
||||||
Preconditions.checkArgument(numValues > 0, "\"numValues\" must be > 0");
|
Preconditions.checkArgument(numValues > 0, "\"numValues\" must be > 0");
|
||||||
Preconditions.checkArgument(((lowWatermark > 0)&&(lowWatermark <= 1)),
|
Preconditions.checkArgument(((lowWatermark > 0)&&(lowWatermark <= 1)),
|
||||||
"\"lowWatermark\" must be > 0 and <= 1");
|
"\"lowWatermark\" must be > 0 and <= 1");
|
||||||
|
final int watermarkValue = (int) (numValues * lowWatermark);
|
||||||
|
Preconditions.checkArgument(watermarkValue > 0,
|
||||||
|
"(int) (\"numValues\" * \"lowWatermark\") must be > 0");
|
||||||
Preconditions.checkArgument(expiry > 0, "\"expiry\" must be > 0");
|
Preconditions.checkArgument(expiry > 0, "\"expiry\" must be > 0");
|
||||||
Preconditions.checkArgument(numFillerThreads > 0,
|
Preconditions.checkArgument(numFillerThreads > 0,
|
||||||
"\"numFillerThreads\" must be > 0");
|
"\"numFillerThreads\" must be > 0");
|
||||||
|
@ -243,8 +246,7 @@ public class ValueQueue <E> {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
LinkedBlockingQueue<E> keyQueue =
|
LinkedBlockingQueue<E> keyQueue =
|
||||||
new LinkedBlockingQueue<E>();
|
new LinkedBlockingQueue<E>();
|
||||||
refiller.fillQueueForKey(keyName, keyQueue,
|
refiller.fillQueueForKey(keyName, keyQueue, watermarkValue);
|
||||||
(int)(lowWatermark * numValues));
|
|
||||||
return keyQueue;
|
return keyQueue;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue