try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroupTasks());
try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); client.transaction( create(Paths.configDeploymentGroup(deploymentGroup.getName()), deploymentGroup),
@Override public boolean tryToRegister(final ZooKeeperClient client) throws KeeperException { client.ensurePath(Paths.configHosts()); client.ensurePath(Paths.configJobs()); client.ensurePath(Paths.configJobRefs()); client.ensurePath(Paths.statusHosts()); client.ensurePath(Paths.statusMasters()); client.ensurePath(Paths.historyJobs()); client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); if (upNode == null) { final String upPath = Paths.statusMasterUp(name); client.ensurePath(upPath, true); upNode = client.persistentEphemeralNode(upPath, Mode.EPHEMERAL, new byte[]{}); upNode.start(); } log.info("ZooKeeper registration complete"); return true; } }
@Override public void tryToRegister(final ZooKeeperClient client) throws KeeperException { client.ensurePath(Paths.configHosts()); client.ensurePath(Paths.configJobs()); client.ensurePath(Paths.configJobRefs()); client.ensurePath(Paths.statusHosts()); client.ensurePath(Paths.statusMasters()); client.ensurePath(Paths.historyJobs()); client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); if (upNode == null) { final String upPath = Paths.statusMasterUp(name); upNode = client.persistentEphemeralNode(upPath, Mode.EPHEMERAL, new byte[]{}); upNode.start(); } log.info("ZooKeeper registration complete"); } }
@Override public void addDeploymentGroup(final DeploymentGroup deploymentGroup) throws DeploymentGroupExistsException { log.info("adding deployment-group: {}", deploymentGroup); final ZooKeeperClient client = provider.get("addDeploymentGroup"); try { try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); client.transaction( create(Paths.configDeploymentGroup(deploymentGroup.getName()), deploymentGroup), create(Paths.statusDeploymentGroup(deploymentGroup.getName())), create(Paths.statusDeploymentGroupHosts(deploymentGroup.getName())) ); } catch (final NodeExistsException e) { throw new DeploymentGroupExistsException(deploymentGroup.getName()); } } catch (final KeeperException e) { throw new HeliosRuntimeException("adding deployment-group " + deploymentGroup + " failed", e); } }