E - type of elements in this queuepublic class CoDelBlockingQueue<E extends CDQEntry> extends LinkedBlockingQueue<E>
Implements the CoDel algorithm from RFC 8289 for managing queue congestion and controlling latency through packet dropping. Provides active queue management with automatic dropping when queue delay exceeds configurable thresholds.
Code and comments are derived from RFC 8289 appendix, implementing the standard CoDel algorithm with configurable target delay and interval parameters. Monitors queue sojourn time and drops packets when above target to maintain optimal throughput and latency characteristics.
Input methods are overridden to add timestamps for delay calculation. Output methods implement AQM behavior with comprehensive statistics tracking for performance monitoring.
| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_CODEL_INTERVAL |
static String |
PROP_CODEL_TARGET |
| Constructor and Description |
|---|
CoDelBlockingQueue(I2PAppContext ctx,
String name,
int capacity)
Target 15, interval 100
|
CoDelBlockingQueue(I2PAppContext ctx,
String name,
int capacity,
int target,
int interval) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o) |
void |
clear() |
int |
drainAllTo(Collection<? super E> c)
Drains all, without updating stats or dropping.
|
int |
drainTo(Collection<? super E> c)
Updates stats and possibly drops while draining.
|
int |
drainTo(Collection<? super E> c,
int maxElements)
Updates stats and possibly drops while draining.
|
boolean |
isBacklogged()
Has the head of the queue been waiting too long,
or is the queue almost full?
|
boolean |
isNearlyFull()
Check if the queue is nearly full (above threshold).
|
boolean |
offer(E o) |
boolean |
offer(E o,
long timeout,
TimeUnit unit) |
E |
poll() |
void |
put(E o) |
E |
take() |
contains, iterator, peek, poll, remainingCapacity, remove, size, spliterator, toArray, toArray, toStringaddAll, element, removecontainsAll, isEmpty, removeAll, retainAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, streampublic static final String PROP_CODEL_INTERVAL
public static final String PROP_CODEL_TARGET
public CoDelBlockingQueue(I2PAppContext ctx, String name, int capacity)
name - for statspublic CoDelBlockingQueue(I2PAppContext ctx, String name, int capacity, int target, int interval)
target - the target max latency (ms)interval - how long above target to start dropping (ms)name - for statspublic boolean add(E o)
public void clear()
clear in interface Collection<E extends CDQEntry>clear in class LinkedBlockingQueue<E extends CDQEntry>public int drainAllTo(Collection<? super E> c)
public int drainTo(Collection<? super E> c)
drainTo in interface BlockingQueue<E extends CDQEntry>drainTo in class LinkedBlockingQueue<E extends CDQEntry>public int drainTo(Collection<? super E> c, int maxElements)
drainTo in interface BlockingQueue<E extends CDQEntry>drainTo in class LinkedBlockingQueue<E extends CDQEntry>public boolean isBacklogged()
public boolean isNearlyFull()
public boolean offer(E o)
public boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<E extends CDQEntry>offer in class LinkedBlockingQueue<E extends CDQEntry>InterruptedExceptionpublic E poll()
public void put(E o) throws InterruptedException
put in interface BlockingQueue<E extends CDQEntry>put in class LinkedBlockingQueue<E extends CDQEntry>InterruptedExceptionpublic E take() throws InterruptedException
take in interface BlockingQueue<E extends CDQEntry>take in class LinkedBlockingQueue<E extends CDQEntry>InterruptedException