You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gossip.apache.org by "Rishabh Patel (JIRA)" <ji...@apache.org> on 2016/10/17 19:58:58 UTC

[jira] [Created] (GOSSIP-30) Use getDeadMembers instead of getDeadList

Rishabh Patel created GOSSIP-30:
-----------------------------------

             Summary: Use getDeadMembers instead of getDeadList
                 Key: GOSSIP-30
                 URL: https://issues.apache.org/jira/browse/GOSSIP-30
             Project: Gossip
          Issue Type: Improvement
            Reporter: Rishabh Patel
            Assignee: Rishabh Patel


The getDeadList method is a duplicate of getDeadMembers

{code:title=GossipManager.java}
public List<LocalGossipMember> getDeadMembers() {
    List<LocalGossipMember> down = new ArrayList<>();
    for (Entry<LocalGossipMember, GossipState> entry : members.entrySet()) {
      if (GossipState.DOWN.equals(entry.getValue())) {
        down.add(entry.getKey());
      }
    }
    return Collections.unmodifiableList(down);
  }
public List<LocalGossipMember> getDeadList() {
    List<LocalGossipMember> up = new ArrayList<>();
    for (Entry<LocalGossipMember, GossipState> entry : members.entrySet()) {
      if (GossipState.DOWN.equals(entry.getValue())) {
        up.add(entry.getKey());
      }
    }
    return Collections.unmodifiableList(up);
  }
{code}

I recommend removing getDeadList, as now we can use the pair of similarly named methods getLiveMembers and getDeadMembers



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)