public class PeerMessageQueue
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
long |
getMessageQueueLengthBytes() |
long |
getNextUrgentTime(long t,
long returnIfBefore)
Get the time at which the next message must be sent.
|
MessageItem |
grabQueuedMessageItem(int minPriority)
Grab a message to send.
|
MessageItem[] |
grabQueuedMessageItems() |
boolean |
mustSendNow(long now)
Returns
true if there are messages that will timeout before
now . |
boolean |
mustSendSize(int minSize,
int maxSize)
Returns
true if minSize + the length of all
messages in this queue is greater than maxSize . |
int |
queueAndEstimateSize(MessageItem item,
int maxSize)
Queue a
MessageItem and return an estimate of the size of
this queue. |
boolean |
removeMessage(MessageItem message) |
void |
removeUIDsFromMessageQueues(java.lang.Long[] list) |
public int queueAndEstimateSize(MessageItem item, int maxSize)
MessageItem
and return an estimate of the size of
this queue. The value returned is the estimated number of bytes
needed for sending the all messages in this queue. Note that if the
returned estimate is higher than 1024, it might not cover all messages.item
- the MessageItem
to queuepublic long getMessageQueueLengthBytes()
public MessageItem[] grabQueuedMessageItems()
public long getNextUrgentTime(long t, long returnIfBefore)
t
- The current next urgent time. The return value will be no greater
than this.returnIfBefore
- The current time. If the next urgent time is less than
this we return immediately rather than computing an accurate past value.
Set to Long.MAX_VALUE if you want an accurate value.public boolean mustSendNow(long now)
true
if there are messages that will timeout before
now
.now
- the timeout for messages waiting to be senttrue
if there are messages that will timeout before
now
public boolean mustSendSize(int minSize, int maxSize)
true
if minSize
+ the length of all
messages in this queue is greater than maxSize
.minSize
- the starting sizemaxSize
- the maximum sizetrue
if minSize
+ the length of all
messages in this queue is greater than maxSize
public MessageItem grabQueuedMessageItem(int minPriority)
public boolean removeMessage(MessageItem message)
public void removeUIDsFromMessageQueues(java.lang.Long[] list)