Exemple #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;
  }
Exemple #2
0
 public DISCARD removeIgnoredMember(Address member) {
   ignoredMembers.remove(member);
   return this;
 }
Exemple #3
0
 public DISCARD resetIgnoredMembers() {
   ignoredMembers.clear();
   return this;
 }
Exemple #4
0
 /** Messages from this sender will get dropped */
 public DISCARD addIgnoreMember(Address sender) {
   ignoredMembers.add(sender);
   return this;
 }