public class TimeLimitedQueue extends LimitedQueue<Event>
Event
s that discards past
events older than a specified time limit. It will additionally discard old
events when reaching a set maximum capacity.Constructor and Description |
---|
TimeLimitedQueue(int capacity,
long timeWindow,
TimeUnit unit)
Creates a new queue with the specified maximum capacity and time window
for keeping events in the queue.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Event event) |
addAll, clear, contains, containsAll, drainTo, drainTo, element, getQueue, isEmpty, iterator, offer, offer, peek, poll, poll, put, remainingCapacity, remove, remove, removeAll, retainAll, size, take, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode
public TimeLimitedQueue(int capacity, long timeWindow, TimeUnit unit)
capacity
- maximum capacity before discarding eventstimeWindow
- time to keep events in the specified unitunit
- unit for the time windowpublic boolean add(Event event)
add
in interface Collection<Event>
add
in interface BlockingQueue<Event>
add
in interface Queue<Event>
add
in class LimitedQueue<Event>
Copyright © 2018 CoR-Lab. All rights reserved.