Beispiel #1
0
  /** Checks if a message should be passed up, or not */
  protected boolean shouldDropUpMessage(
      @SuppressWarnings("UnusedParameters") Message msg, Address sender) {
    if (discard_all && !sender.equals(localAddress())) return true;

    if (ignoredMembers.contains(sender)) {
      if (log.isTraceEnabled()) log.trace(localAddress + ": dropping message from " + sender);
      num_up++;
      return true;
    }

    if (up > 0) {
      double r = Math.random();
      if (r < up) {
        if (excludeItself && sender.equals(localAddress())) {
          if (log.isTraceEnabled()) log.trace("excluding myself");
        } else {
          if (log.isTraceEnabled()) log.trace(localAddress + ": dropping message from " + sender);
          num_up++;
          return true;
        }
      }
    }

    return false;
  }
Beispiel #2
0
 public DISCARD removeIgnoredMember(Address member) {
   ignoredMembers.remove(member);
   return this;
 }
Beispiel #3
0
 public DISCARD resetIgnoredMembers() {
   ignoredMembers.clear();
   return this;
 }
Beispiel #4
0
 /** Messages from this sender will get dropped */
 public DISCARD addIgnoreMember(Address sender) {
   ignoredMembers.add(sender);
   return this;
 }