Class CachedEntryQueue
java.lang.Object
org.apache.hadoop.hbase.io.hfile.bucket.CachedEntryQueue
A memory-bound queue that will grow until an element brings total size larger than maxSize. From
then on, only entries that are sorted larger than the smallest current entry will be
inserted/replaced.
Use this when you want to find the largest elements (according to their ordering, not their heap size) that consume as close to the specified maxSize as possible. Default behavior is to grow just above rather than just below specified max.
-
Field Summary
Modifier and TypeFieldDescriptionprivate long
private static final Comparator<Map.Entry<BlockCacheKey,
BucketEntry>> private long
private org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<Map.Entry<BlockCacheKey,
BucketEntry>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Map.Entry<BlockCacheKey, BucketEntry> entry) Attempt to add the specified entry to this queue.poll()
Returns The next element in this queue, ornull
if the queue is empty.pollLast()
Returns The last element in this queue, ornull
if the queue is empty.
-
Field Details
-
COMPARATOR
-
queue
private org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<Map.Entry<BlockCacheKey,BucketEntry>> queue -
cacheSize
-
maxSize
-
-
Constructor Details
-
CachedEntryQueue
- Parameters:
maxSize
- the target size of elements in the queueblockSize
- expected average size of blocks
-
-
Method Details
-
add
Attempt to add the specified entry to this queue.If the queue is smaller than the max size, or if the specified element is ordered after the smallest element in the queue, the element will be added to the queue. Otherwise, there is no side effect of this call.
- Parameters:
entry
- a bucket entry with key to try to add to the queue
-
poll
Returns The next element in this queue, ornull
if the queue is empty. -
pollLast
Returns The last element in this queue, ornull
if the queue is empty.
-