public static void copyStat(Stat from, Stat to) { to.setAversion(from.getAversion()); to.setCtime(from.getCtime()); to.setCversion(from.getCversion()); to.setCzxid(from.getCzxid()); to.setMtime(from.getMtime()); to.setMzxid(from.getMzxid()); to.setPzxid(from.getPzxid()); to.setVersion(from.getVersion()); to.setEphemeralOwner(from.getEphemeralOwner()); to.setDataLength(from.getDataLength()); to.setNumChildren(from.getNumChildren()); }
public boolean setData(ZookeeperConnection zkConn, String path, String content) throws IOException { if (zkConn != null) { try { Stat stat = zkConn.createZookeeper().setData(path, content.getBytes(), -1); System.out.print("stat:aversion:" + stat.getAversion() + "|" + stat.getCversion()); zkConn.close(); } catch (InterruptedException e) { e.printStackTrace(); return false; } catch (KeeperException e) { e.printStackTrace(); return false; } } return true; }