/** * Set master address into the <code>master</code> znode or into the backup * subdirectory of backup masters; switch off the passed in <code>znode</code> * path. * * @param zkw * The ZooKeeperWatcher to use. * @param znode * Where to create the znode; could be at the top level or it could * be under backup masters * @param master * ServerName of the current master * @return true if node created, false if not; a watch is set in both cases * @throws org.apache.zookeeper.KeeperException */ public static boolean setMasterAddress(final ZooKeeperWatcher zkw, final String znode, final ServerName master) throws KeeperException { return ZKUtil.createEphemeralNodeAndWatch(zkw, znode, toByteArray(master)); }