KeyType - can be a class or object defined by the user that stores information about a MetricDatum needed
by the user.
The following is a example of what a KeyType class might look like:
class SampleKeyType {
private long timeKeyCreated;
private MetricDatum datum;
public SampleKeyType(long timeKeyCreated, MetricDatum datum){
this.timeKeyCreated = timeKeyCreated;
this.datum = datum;
}
}public class MetricAccumulatingQueue<KeyType>
extends java.lang.Object
| Constructor and Description |
|---|
MetricAccumulatingQueue(int maxQueueSize) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<MetricDatumWithKey<KeyType>> |
drain(int maxItems) |
boolean |
isEmpty() |
boolean |
offer(KeyType key,
MetricDatum datum)
We use a queue and a map in this method.
|
int |
size() |
public java.util.List<MetricDatumWithKey<KeyType>> drain(int maxItems)
maxItems - number of items to remove from the queue.public boolean isEmpty()
public int size()
public boolean offer(KeyType key, MetricDatum datum)
key - metric key to be inserted into queuedatum - metric to be inserted into queue