@InterfaceAudience.Private public class CachedEntryQueue extends Object
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.
Modifier and Type | Field and Description |
---|---|
private long |
cacheSize |
private static Comparator<Map.Entry<BlockCacheKey,BucketEntry>> |
COMPARATOR |
private long |
maxSize |
private org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<Map.Entry<BlockCacheKey,BucketEntry>> |
queue |
Constructor and Description |
---|
CachedEntryQueue(long maxSize,
long blockSize) |
Modifier and Type | Method and Description |
---|---|
void |
add(Map.Entry<BlockCacheKey,BucketEntry> entry)
Attempt to add the specified entry to this queue.
|
Map.Entry<BlockCacheKey,BucketEntry> |
poll() |
Map.Entry<BlockCacheKey,BucketEntry> |
pollLast() |
private static final Comparator<Map.Entry<BlockCacheKey,BucketEntry>> COMPARATOR
private org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<Map.Entry<BlockCacheKey,BucketEntry>> queue
private long cacheSize
private long maxSize
public CachedEntryQueue(long maxSize, long blockSize)
maxSize
- the target size of elements in the queueblockSize
- expected average size of blockspublic void add(Map.Entry<BlockCacheKey,BucketEntry> entry)
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.
entry
- a bucket entry with key to try to add to the queuepublic Map.Entry<BlockCacheKey,BucketEntry> poll()
null
if the queue is
empty.public Map.Entry<BlockCacheKey,BucketEntry> pollLast()
null
if the queue is
empty.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.