@Override
    public int compare(DbEndpoint e1, DbEndpoint e2) {
      if (e1.isWriteable() != e2.isWriteable()) {
        return e1.isWriteable() ? -1 : 1;
      }
      // Both writeable or not, so decide on datacenter
      if (!e1.getDatacenter().equals(e2.getDatacenter())) {
        return e1.getDatacenter().equals(localDatacenter) ? -1 : e2.getDatacenter().equals(localDatacenter) ? 1 : 0;
      }
      return 0;
    }
Comparator for instances of {@link DbEndpoint} that orders first by writeable instances, then by ones in local
datacenter.
ambry-mysql/src/main/java/com/github/ambry/mysql/MySqlDataAccessor.java