@InterfaceAudience.Private public class AdaptiveLifoCoDelCallQueue extends java.lang.Object implements java.util.concurrent.BlockingQueue<CallRunner>
BlockingQueue interface to be compatible with RpcExecutor.
Currently uses milliseconds internally, need to look into whether we should use
nanoseconds for timeInterval and minDelay.| Constructor and Description |
|---|
AdaptiveLifoCoDelCallQueue(int capacity,
int targetDelay,
int interval,
double lifoThreshold,
java.util.concurrent.atomic.AtomicLong numGeneralCallsDropped,
java.util.concurrent.atomic.AtomicLong numLifoModeSwitches) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(CallRunner callRunner) |
boolean |
addAll(java.util.Collection<? extends CallRunner> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
int |
drainTo(java.util.Collection<? super CallRunner> c) |
int |
drainTo(java.util.Collection<? super CallRunner> c,
int maxElements) |
CallRunner |
element() |
boolean |
isEmpty() |
java.util.Iterator<CallRunner> |
iterator() |
boolean |
offer(CallRunner callRunner) |
boolean |
offer(CallRunner callRunner,
long timeout,
java.util.concurrent.TimeUnit unit) |
CallRunner |
peek() |
CallRunner |
poll() |
CallRunner |
poll(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
put(CallRunner callRunner) |
int |
remainingCapacity() |
CallRunner |
remove() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
CallRunner |
take()
Behaves as
LinkedBlockingQueue.take(), except it will silently
skip all calls which it thinks should be dropped. |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
void |
updateTunables(int newCodelTargetDelay,
int newCodelInterval,
double newLifoThreshold)
Update tunables.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic AdaptiveLifoCoDelCallQueue(int capacity,
int targetDelay,
int interval,
double lifoThreshold,
java.util.concurrent.atomic.AtomicLong numGeneralCallsDropped,
java.util.concurrent.atomic.AtomicLong numLifoModeSwitches)
public void updateTunables(int newCodelTargetDelay,
int newCodelInterval,
double newLifoThreshold)
newCodelTargetDelay - new CoDel target delaynewCodelInterval - new CoDel intervalnewLifoThreshold - new Adaptive Lifo thresholdpublic CallRunner take() throws java.lang.InterruptedException
LinkedBlockingQueue.take(), except it will silently
skip all calls which it thinks should be dropped.take in interface java.util.concurrent.BlockingQueue<CallRunner>java.lang.InterruptedException - if interrupted while waitingpublic CallRunner poll()
poll in interface java.util.Queue<CallRunner>public boolean offer(CallRunner callRunner)
offer in interface java.util.concurrent.BlockingQueue<CallRunner>offer in interface java.util.Queue<CallRunner>public int size()
size in interface java.util.Collection<CallRunner>public java.lang.String toString()
toString in class java.lang.Objectpublic CallRunner poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
poll in interface java.util.concurrent.BlockingQueue<CallRunner>java.lang.InterruptedExceptionpublic CallRunner peek()
peek in interface java.util.Queue<CallRunner>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<CallRunner>remove in interface java.util.concurrent.BlockingQueue<CallRunner>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<CallRunner>contains in interface java.util.concurrent.BlockingQueue<CallRunner>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<CallRunner>public <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<CallRunner>public void clear()
clear in interface java.util.Collection<CallRunner>public int drainTo(java.util.Collection<? super CallRunner> c)
drainTo in interface java.util.concurrent.BlockingQueue<CallRunner>public int drainTo(java.util.Collection<? super CallRunner> c, int maxElements)
drainTo in interface java.util.concurrent.BlockingQueue<CallRunner>public java.util.Iterator<CallRunner> iterator()
iterator in interface java.lang.Iterable<CallRunner>iterator in interface java.util.Collection<CallRunner>public boolean add(CallRunner callRunner)
add in interface java.util.Collection<CallRunner>add in interface java.util.concurrent.BlockingQueue<CallRunner>add in interface java.util.Queue<CallRunner>public CallRunner remove()
remove in interface java.util.Queue<CallRunner>public CallRunner element()
element in interface java.util.Queue<CallRunner>public boolean addAll(java.util.Collection<? extends CallRunner> c)
addAll in interface java.util.Collection<CallRunner>public boolean isEmpty()
isEmpty in interface java.util.Collection<CallRunner>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<CallRunner>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<CallRunner>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<CallRunner>public int remainingCapacity()
remainingCapacity in interface java.util.concurrent.BlockingQueue<CallRunner>public void put(CallRunner callRunner) throws java.lang.InterruptedException
put in interface java.util.concurrent.BlockingQueue<CallRunner>java.lang.InterruptedExceptionpublic boolean offer(CallRunner callRunner, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offer in interface java.util.concurrent.BlockingQueue<CallRunner>java.lang.InterruptedException