public MapEvent put(String trackingId,byte[] data,long timeout) throws KeeperException, InterruptedException {
  String path=createData(dir + "/" + prefix+ trackingId,data,CreateMode.PERSISTENT);
  String watchID=createData(dir + "/" + response_prefix+ path.substring(path.lastIndexOf("-") + 1),null,CreateMode.EPHEMERAL);
  Object lock=new Object();
  LatchChildWatcher watcher=new LatchChildWatcher(lock);
synchronized (lock) {
    if (zookeeper.exists(watchID,watcher,true) != null) {
      watcher.await(timeout);
    }
  }
  byte[] bytes=zookeeper.getData(watchID,null,null,true);
  zookeeper.delete(watchID,-1,true);
  return new MapEvent(watchID,bytes,watcher.getWatchedEvent());
}

public MapEvent put ( String trackingId , byte [ ] data , long timeout ) throws KeeperException , InterruptedException { String path = createData ( dir + "/" + prefix + trackingId , data , CreateMode . PERSISTENT ) ; String watchID = createData ( dir + "/" + response_prefix + path . substring ( path . lastIndexOf ( "-" ) + 1 ) , null , CreateMode . EPHEMERAL ) ; Object lock = new Object ( ) ; LatchChildWatcher watcher = new LatchChildWatcher ( lock ) ; synchronized ( lock ) { if ( zookeeper . exists ( watchID , watcher , true ) != null ) { watcher . await ( timeout ) ; } } byte [ ] bytes = zookeeper . getData ( watchID , null , null , true ) ; zookeeper . delete ( watchID , - 1 , true ) ; return new MapEvent ( watchID , bytes , watcher . getWatchedEvent ( ) ) ; }
offer the data and wait for the response
