public final class FrequencyTrackingRingBuffer extends Object implements Accountable
| Constructor and Description |
|---|
FrequencyTrackingRingBuffer(int maxSize,
int sentinel)
Create a new ring buffer that will contain at most
maxSize items. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int i)
Add a new item to this ring buffer, potentially removing the oldest
entry from this buffer if it is already full.
|
int |
frequency(int key)
Returns the frequency of the provided key in the ring buffer.
|
Collection<Accountable> |
getChildResources()
Returns nested resources of this class.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
public FrequencyTrackingRingBuffer(int maxSize,
int sentinel)
maxSize items.
This buffer will initially contain maxSize times the
sentinel value.public long ramBytesUsed()
AccountableramBytesUsed in interface Accountablepublic Collection<Accountable> getChildResources()
AccountablegetChildResources in interface AccountableAccountablespublic void add(int i)
public int frequency(int key)
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.