public boolean shouldAddCheckerMaster() { ZooKeeperWatcher zk = super.getZooKeeper(); String numberN = ZKUtil.joinZNode(zk.baseZNode, CCIndexConstants.CheckNumNode); try { if (ZKUtil.checkExists(zk, numberN) != -1) { ZKUtil.createSetData(zk, numberN, Bytes.toBytes(1)); } else { int num = Bytes.toInt(ZKUtil.getData(zk, numberN)); if (num < this.checkMasterN) { ZKUtil.setData(zk, numberN, Bytes.toBytes(num + 1)); return true; } else { return false; } } } catch (KeeperException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }