MCPcopy Create free account
hub / github.com/akeranen/the-one / getNextMessageToRemove

Method getNextMessageToRemove

routing/ActiveRouter.java:325–343  ·  view source on GitHub ↗

Returns the oldest (by receive time) message in the message buffer (that is not being sent if excludeMsgBeingSent is true). @param excludeMsgBeingSent If true, excludes message(s) that are being sent from the oldest message check (i.e. if oldest message is being sent, the second oldest message is re

(boolean excludeMsgBeingSent)

Source from the content-addressed store, hash-verified

323 * exludeMsgBeingSent is true)
324 */
325 protected Message getNextMessageToRemove(boolean excludeMsgBeingSent) {
326 Collection<Message> messages = this.getMessageCollection();
327 Message oldest = null;
328 for (Message m : messages) {
329
330 if (excludeMsgBeingSent && isSending(m.getId())) {
331 continue; // skip the message(s) that router is sending
332 }
333
334 if (oldest == null ) {
335 oldest = m;
336 }
337 else if (oldest.getReceiveTime() > m.getReceiveTime()) {
338 oldest = m;
339 }
340 }
341
342 return oldest;
343 }
344
345 /**
346 * Returns a list of message-connections tuples of the messages whose

Callers 1

makeRoomForMessageMethod · 0.95

Calls 4

isSendingMethod · 0.95
getReceiveTimeMethod · 0.95
getIdMethod · 0.80
getMessageCollectionMethod · 0.45

Tested by

no test coverage detected