class TimedWeightedPriorityMessageQueue extends Object implements MessageQueue, OutboundMessageFragments.ActiveThrottle
Modifier and Type | Class and Description |
---|---|
static interface |
TimedWeightedPriorityMessageQueue.FailedListener |
Constructor and Description |
---|
TimedWeightedPriorityMessageQueue(RouterContext ctx,
int[] priorityLimits,
int[] weighting,
TimedWeightedPriorityMessageQueue.FailedListener lsnr)
Build up a new queue
|
Modifier and Type | Method and Description |
---|---|
void |
add(OutNetMessage message)
Add on a new message to the queue
|
void |
choke(Hash peer) |
OutNetMessage |
getNext(long blockUntil)
Grab the next message out of the next queue.
|
boolean |
isChoked(Hash peer) |
void |
shutdown() |
void |
unchoke(Hash peer) |
public TimedWeightedPriorityMessageQueue(RouterContext ctx, int[] priorityLimits, int[] weighting, TimedWeightedPriorityMessageQueue.FailedListener lsnr)
priorityLimits
- ordered breakpoint for the different message
priorities, with the lowest limit first.weighting
- how much to prefer a given priority grouping.
specifically, this means how many messages in this queue
should be pulled off in a row before moving on to the next.public void add(OutNetMessage message)
MessageQueue
add
in interface MessageQueue
public OutNetMessage getNext(long blockUntil)
getNext
in interface MessageQueue
blockUntil
- expiration, or -1 if indefinitepublic void shutdown()
public void choke(Hash peer)
choke
in interface OutboundMessageFragments.ActiveThrottle
public void unchoke(Hash peer)
unchoke
in interface OutboundMessageFragments.ActiveThrottle
public boolean isChoked(Hash peer)
isChoked
in interface OutboundMessageFragments.ActiveThrottle