public boolean isValid() {
        if (!this.conf.isValid()) {
            return false;
        }

        // The peer set and learner set should not have intersection set.
        final Set<PeerId> intersection = listPeers();
        intersection.retainAll(listLearners());
        if (intersection.isEmpty()) {
            return true;
        }
        LOG.error("Invalid conf entry {}, peers and learners have intersection: {}.", this, intersection);
        return false;
    }
@Test
    public void testIsValid() {
        ConfigurationEntry entry = TestUtils.getConfEntry("localhost:8081,localhost:8082,localhost:8083", null);
        assertTrue(entry.isValid());

        entry = TestUtils.getConfEntry("localhost:8081,localhost:8082,localhost:8083",
            "localhost:8081,localhost:8082,localhost:8084");
        assertTrue(entry.isValid());

        entry.getConf().addLearner(new PeerId("localhost", 8084));
        assertFalse(entry.isValid());
        entry.getConf().addLearner(new PeerId("localhost", 8081));
        assertFalse(entry.isValid());
    }