@InterfaceAudience.Private public class AdaptiveLifoCoDelCallQueue extends Object implements 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,
AtomicLong numGeneralCallsDropped,
AtomicLong numLifoModeSwitches) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(CallRunner callRunner) |
boolean |
addAll(Collection<? extends CallRunner> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
int |
drainTo(Collection<? super CallRunner> c) |
int |
drainTo(Collection<? super CallRunner> c,
int maxElements) |
CallRunner |
element() |
boolean |
isEmpty() |
Iterator<CallRunner> |
iterator() |
boolean |
offer(CallRunner callRunner) |
boolean |
offer(CallRunner callRunner,
long timeout,
TimeUnit unit) |
CallRunner |
peek() |
CallRunner |
poll() |
CallRunner |
poll(long timeout,
TimeUnit unit) |
void |
put(CallRunner callRunner) |
int |
remainingCapacity() |
CallRunner |
remove() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
CallRunner |
take()
Behaves as
LinkedBlockingQueue.take() , except it will silently
skip all calls which it thinks should be dropped. |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
void |
updateTunables(int newCodelTargetDelay,
int newCodelInterval,
double newLifoThreshold)
Update tunables.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
public AdaptiveLifoCoDelCallQueue(int capacity, int targetDelay, int interval, double lifoThreshold, AtomicLong numGeneralCallsDropped, 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 InterruptedException
LinkedBlockingQueue.take()
, except it will silently
skip all calls which it thinks should be dropped.take
in interface BlockingQueue<CallRunner>
InterruptedException
- if interrupted while waitingpublic CallRunner poll()
poll
in interface Queue<CallRunner>
public boolean offer(CallRunner callRunner)
offer
in interface BlockingQueue<CallRunner>
offer
in interface Queue<CallRunner>
public int size()
size
in interface Collection<CallRunner>
public CallRunner poll(long timeout, TimeUnit unit) throws InterruptedException
poll
in interface BlockingQueue<CallRunner>
InterruptedException
public CallRunner peek()
peek
in interface Queue<CallRunner>
public boolean remove(Object o)
remove
in interface Collection<CallRunner>
remove
in interface BlockingQueue<CallRunner>
public boolean contains(Object o)
contains
in interface Collection<CallRunner>
contains
in interface BlockingQueue<CallRunner>
public Object[] toArray()
toArray
in interface Collection<CallRunner>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<CallRunner>
public void clear()
clear
in interface Collection<CallRunner>
public int drainTo(Collection<? super CallRunner> c)
drainTo
in interface BlockingQueue<CallRunner>
public int drainTo(Collection<? super CallRunner> c, int maxElements)
drainTo
in interface BlockingQueue<CallRunner>
public Iterator<CallRunner> iterator()
iterator
in interface Iterable<CallRunner>
iterator
in interface Collection<CallRunner>
public boolean add(CallRunner callRunner)
add
in interface Collection<CallRunner>
add
in interface BlockingQueue<CallRunner>
add
in interface Queue<CallRunner>
public CallRunner remove()
remove
in interface Queue<CallRunner>
public CallRunner element()
element
in interface Queue<CallRunner>
public boolean addAll(Collection<? extends CallRunner> c)
addAll
in interface Collection<CallRunner>
public boolean isEmpty()
isEmpty
in interface Collection<CallRunner>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<CallRunner>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<CallRunner>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<CallRunner>
public int remainingCapacity()
remainingCapacity
in interface BlockingQueue<CallRunner>
public void put(CallRunner callRunner) throws InterruptedException
put
in interface BlockingQueue<CallRunner>
InterruptedException
public boolean offer(CallRunner callRunner, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<CallRunner>
InterruptedException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.