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

Method getNextMessageToRemove

routing/MaxPropRouter.java:270–286  ·  view source on GitHub ↗

Returns the next message that should be dropped, according to MaxProp's message ordering scheme (see MaxPropTupleComparator). @param excludeMsgBeingSent If true, excludes message(s) that are being sent from the next-to-be-dropped check (i.e., if next message to drop is being sent, the follow

(boolean excludeMsgBeingSent)

Source from the content-addressed store, hash-verified

268 * exludeMsgBeingSent is true)
269 */
270 @Override
271 protected Message getNextMessageToRemove(boolean excludeMsgBeingSent) {
272 Collection<Message> messages = this.getMessageCollection();
273 List<Message> validMessages = new ArrayList<Message>();
274
275 for (Message m : messages) {
276 if (excludeMsgBeingSent && isSending(m.getId())) {
277 continue; // skip the message(s) that router is sending
278 }
279 validMessages.add(m);
280 }
281
282 Collections.sort(validMessages,
283 new MaxPropComparator(this.calcThreshold()));
284
285 return validMessages.get(validMessages.size()-1); // return last message
286 }
287
288 @Override
289 public void update() {

Callers

nothing calls this directly

Calls 6

calcThresholdMethod · 0.95
isSendingMethod · 0.80
getIdMethod · 0.80
addMethod · 0.80
getMessageCollectionMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected