本文整理了Java中com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.set()
方法的一些代码示例,展示了ZooKeeperOperations.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperOperations.set()
方法的具体详情如下:
包路径:com.spotify.helios.servicescommon.coordination.ZooKeeperOperations
类名称:ZooKeeperOperations
方法名:set
暂无
代码示例来源:origin: spotify/helios
public RollingUpdateOp nextTask(final List<ZooKeeperOperation> operations) {
final List<ZooKeeperOperation> ops = Lists.newArrayList(operations);
final List<Map<String, Object>> events = Lists.newArrayList();
final RolloutTask task = tasks.getRolloutTasks().get(tasks.getTaskIndex());
// Update the task index, delete tasks if done
if (tasks.getTaskIndex() + 1 == tasks.getRolloutTasks().size()) {
final DeploymentGroupStatus status = DeploymentGroupStatus.newBuilder()
.setState(DONE)
.build();
// We are done -> delete tasks & update status
ops.add(delete(Paths.statusDeploymentGroupTasks(deploymentGroup.getName())));
ops.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()),
status));
// Emit an event signalling that we're DONE!
events.add(eventFactory.rollingUpdateDone(deploymentGroup));
} else {
ops.add(
set(Paths.statusDeploymentGroupTasks(deploymentGroup.getName()), tasks.toBuilder()
.setTaskIndex(tasks.getTaskIndex() + 1)
.build()));
// Only emit an event if the task resulted in taking in action. If there are no ZK operations
// the task was effectively a no-op.
if (!operations.isEmpty()) {
events.add(eventFactory.rollingUpdateTaskSucceeded(deploymentGroup, task));
}
}
return new RollingUpdateOp(ImmutableList.copyOf(ops), ImmutableList.copyOf(events));
}
代码示例来源:origin: spotify/helios
operations.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()), status));
代码示例来源:origin: spotify/helios
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
client.transaction(operations.build());
} catch (final NoNodeException e) {
代码示例来源:origin: spotify/helios
.setState(ROLLING_OUT)
.build();
ops.add(set(Paths.statusDeploymentGroupTasks(deploymentGroup.getName()), tasks));
ops.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()), status));
代码示例来源:origin: spotify/helios
operations.add(set(statusPath, status));
代码示例来源:origin: spotify/helios
ops.add(set(Paths.statusDeploymentGroupHosts(groupName), Json.asBytes(hosts)));
ops.add(set(Paths.statusDeploymentGroupRemovedHosts(groupName), Json.asBytes(removedHosts)));
ops.add(set(Paths.configDeploymentGroup(deploymentGroup.getName()), deploymentGroup));
代码示例来源:origin: spotify/helios
final ZooKeeperClient client = provider.get("rollingUpdate");
operations.add(set(Paths.configDeploymentGroup(updated.getName()), updated));
代码示例来源:origin: spotify/helios
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
} catch (final NodeExistsException e) {
if (client.exists(creationPath) != null) {
代码示例来源:origin: spotify/helios
set(Paths.statusDeploymentGroupRemovedHosts(deploymentGroup.getName()),
Json.asBytes(hostsToUndeploy))));
} catch (KeeperException | IOException e) {
代码示例来源:origin: at.molindo/helios-services
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
client.transaction(operations.build());
} catch (final NoNodeException e) {
代码示例来源:origin: at.molindo/helios-services
@Override
public void stopDeploymentGroup(final String deploymentGroupName)
throws DeploymentGroupDoesNotExistException {
checkNotNull(deploymentGroupName, "name");
log.info("stop deployment-group: name={}", deploymentGroupName);
final ZooKeeperClient client = provider.get("stopDeploymentGroup");
final DeploymentGroup deploymentGroup = getDeploymentGroup(deploymentGroupName);
final String statusPath = Paths.statusDeploymentGroup(deploymentGroupName);
final DeploymentGroupStatus status = DeploymentGroupStatus.newBuilder()
.setDeploymentGroup(deploymentGroup)
.setState(FAILED)
.setError("Stopped by user")
.build();
try {
client.ensurePath(statusPath);
client.transaction(set(statusPath, status));
} catch (final NoNodeException e) {
throw new DeploymentGroupDoesNotExistException(deploymentGroupName);
} catch (final KeeperException e) {
throw new HeliosRuntimeException(
"stop deployment-group " + deploymentGroupName + " failed", e);
}
}
代码示例来源:origin: at.molindo/helios-services
set(Paths.configJobs(), UUID.randomUUID().toString().getBytes()));
} catch (final NodeExistsException e) {
if (client.exists(creationPath) != null) {
代码示例来源:origin: at.molindo/helios-services
final ZooKeeperClient client = provider.get("rollingUpdate");
operations.add(set(Paths.configDeploymentGroup(deploymentGroup.getName()), updated));
.setState(START_ROLLING_UPDATE)
.build();
operations.add(set(statusPath, initialStatus));
代码示例来源:origin: at.molindo/helios-services
final String errMsg = isNullOrEmpty(result.host) ? result.error.getMessage() :
result.host + ": " + result.error.getMessage();
opsEvents.addOperation(set(statusPath, status.toBuilder()
.setState(FAILED)
.setError(errMsg)
opsEvents.addOperation(set(statusPath, status.toBuilder()
.setSuccessfulIterations(status.getSuccessfulIterations() + 1)
.setState(DONE)
.build()));
} else {
opsEvents.addOperation(set(statusPath, status.toBuilder()
.setTaskIndex(taskIndex + 1)
.build()));
代码示例来源:origin: at.molindo/helios-services
opsEvents.addOperation(set(statusPath, newStatus.build()));
} else if (status.getState().equals(ROLLING_OUT)) {
opsEvents.addOperation(set(statusPath, status.toBuilder()
.setState(PLANNING_ROLLOUT)
.build()));
内容来源于网络,如有侵权,请联系作者删除!