code: public void update(String newPath) throws IOException {
      String id = hostname + Thread.currentThread().getId();
      CurrentInProgressMetadataWritable cip = localWritable.get();
      cip.set(id, newPath);
      byte[] data = WritableUtil.writableToByteArray(cip);
      try {
        zooKeeper.setData(fullyQualifiedZNode, data, expectedZNodeVersion.get());
        if (LOG.isDebugEnabled()) {
          LOG.debug("Set " + fullyQualifiedZNode + " to point to " + newPath);
        }
      } catch (KeeperException.BadVersionException e) {
        // Throw an exception if we try to update without having read the
        // current version
        LOG.error(fullyQualifiedZNode + " has been updated by another process",
            e);
        throw new StaleVersionException(fullyQualifiedZNode +
            "has been updated by another process!");
      } catch (KeeperException e) {
        keeperException("Unrecoverable ZooKeeper error updating " +
            fullyQualifiedZNode, e);
      } catch (InterruptedException e) {
        interruptedException("Interrupted updating " + fullyQualifiedZNode, e);
      }
    }
docs: Update the data in the ZNode to point to a the ZNode containing the
  metadata for the ledger containing the current in-progress edit log
  segment.
  @param newPath Path to the metadata for the current ledger
  @throws StaleVersionException If path read is out of date compared to the
  version in ZooKeeper
  @throws IOException If there is an error talking to ZooKeeper