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)
| 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() { |
nothing calls this directly
no test coverage detected