@Override
 public void addComplete(int rc, LedgerHandle lh, long entryId, Object ctx) {
   SyncObj x = (SyncObj) ctx;
   if (rc != 0) {
     LOG.error("Failure during add {} {}", entryId, rc);
     x.failureOccurred = true;
   }
   synchronized (x) {
     x.counter++;
     x.notify();
   }
 }
 @Override
 public void readComplete(int rc, LedgerHandle lh, Enumeration<LedgerEntry> seq, Object ctx) {
   SyncObj x = (SyncObj) ctx;
   if (rc != 0) {
     LOG.error("Failure during add {}", rc);
     x.failureOccurred = true;
   }
   synchronized (x) {
     x.value = true;
     x.ls = seq;
     x.notify();
   }
 }