Package net.i2p.router.util
Class PriBlockingQueue<E extends PQEntry>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.PriorityBlockingQueue<E>
-
- net.i2p.router.util.PriBlockingQueue<E>
-
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,BlockingQueue<E>
,Queue<E>
- Direct Known Subclasses:
CoDelPriorityBlockingQueue
public class PriBlockingQueue<E extends PQEntry> extends PriorityBlockingQueue<E>
Priority Blocking Queue using methods in the entries, as defined in PQEntry, to store priority and sequence number, ensuring FIFO order within a priority. Input: add(), offer(), and put() are overridden to add a sequence number.- Since:
- 0.9.3
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected I2PAppContext
_context
protected Log
_log
protected String
_name
protected static int
BACKLOG_SIZE
protected static int
MAX_SIZE
protected static long[]
RATES
-
Constructor Summary
Constructors Constructor Description PriBlockingQueue(I2PAppContext ctx, String name, int initialCapacity)
Bounded queue with a hardcoded failsafe max size, except when using put(), which is unbounded.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
add(E o)
Deprecated.use offer(o)boolean
isBacklogged()
Is the queue too big?boolean
offer(E o)
Returns false if fullboolean
offer(E o, long timeout, TimeUnit unit)
Deprecated.use offer(o)void
put(E o)
Deprecated.use offer(o)protected void
timestamp(E o)
-
Methods inherited from class java.util.concurrent.PriorityBlockingQueue
clear, comparator, contains, drainTo, drainTo, forEach, iterator, peek, poll, poll, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray, toString
-
Methods inherited from class java.util.AbstractQueue
addAll, element, remove
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
-
-
-
Field Detail
-
_context
protected final transient I2PAppContext _context
-
_log
protected final transient Log _log
-
_name
protected final String _name
-
RATES
protected static final long[] RATES
-
BACKLOG_SIZE
protected static final int BACKLOG_SIZE
- See Also:
- Constant Field Values
-
MAX_SIZE
protected static final int MAX_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PriBlockingQueue
public PriBlockingQueue(I2PAppContext ctx, String name, int initialCapacity)
Bounded queue with a hardcoded failsafe max size, except when using put(), which is unbounded.
-
-
Method Detail
-
add
@Deprecated public boolean add(E o)
Deprecated.use offer(o)OpenJDK add(o) calls offer(o), so use offer(o) to avoid dup stamping. Returns false if full
-
offer
public boolean offer(E o)
Returns false if full
-
offer
@Deprecated public boolean offer(E o, long timeout, TimeUnit unit)
Deprecated.use offer(o)OpenJDK offer(o, timeout, unit) calls offer(o), so use offer(o) to avoid dup stamping. Non blocking. Returns false if full.- Specified by:
offer
in interfaceBlockingQueue<E extends PQEntry>
- Overrides:
offer
in classPriorityBlockingQueue<E extends PQEntry>
- Parameters:
timeout
- ignoredunit
- ignored
-
put
@Deprecated public void put(E o)
Deprecated.use offer(o)OpenJDK put(o) calls offer(o), so use offer(o) to avoid dup stamping. Non blocking. Does not add if full.- Specified by:
put
in interfaceBlockingQueue<E extends PQEntry>
- Overrides:
put
in classPriorityBlockingQueue<E extends PQEntry>
-
isBacklogged
public boolean isBacklogged()
Is the queue too big?
-
timestamp
protected void timestamp(E o)
-
-