code: public boolean isOnSameRack( Node node1,  Node node2) {
      if (node1 == null || node2 == null) {
        return false;
      }
        
      netlock.readLock().lock();
      try {
        return node1.getParent()==node2.getParent();
      } finally {
        netlock.readLock().unlock();
      }
    }
docs: Check if two nodes are on the same rack
  @param node1 one node
  @param node2 another node
  @return true if node1 and node2 are pm the same rack; false otherwise
  @exception IllegalArgumentException when either node1 or node2 is null, or
  node1 or node2 do not belong to the cluster