@Test(timeout = 60000)
public void testDumpEphemerals() throws Exception {

    int count = 1000;
    long session = 1000;
    long zxid = 2000;
    final DataTree dataTree = new DataTree();
    LOG.info("Create {} zkclient sessions and its ephemeral nodes", count);
    createEphemeralNode(session, dataTree, count);
    final AtomicBoolean exceptionDuringDumpEphemerals = new AtomicBoolean(
            false);
    final AtomicBoolean running = new AtomicBoolean(true);
    Thread thread = new Thread() {
        public void run() {
            PrintWriter pwriter = new PrintWriter(new StringWriter());
            try {
                while (running.get()) {
                    dataTree.dumpEphemerals(pwriter);
                }
            } catch (Exception e) {
                LOG.error("Received exception while dumpEphemerals!", e);
                exceptionDuringDumpEphemerals.set(true);
            }
        };
    };
    thread.start();
    LOG.debug("Killing {} zkclient sessions and its ephemeral nodes", count);
    killZkClientSession(session, zxid, dataTree, count);
    running.set(false);
    thread.join();
    Assert.assertFalse("Should have got exception while dumpEphemerals!",
            exceptionDuringDumpEphemerals.get());
}