本文整理了Java中org.apache.helix.ZNRecord.update()
方法的一些代码示例,展示了ZNRecord.update()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZNRecord.update()
方法的具体详情如下:
包路径:org.apache.helix.ZNRecord
类名称:ZNRecord
方法名:update
[英]Replace functionality is used to update this ZNRecord with the given ZNRecord. The value of a field in this record will be replaced with the value of the same field in given record if it presents. If there is new field in given ZNRecord but not in this record, add that field into this record. The list fields and map fields will be replaced as a single entry.
[中]替换功能用于使用给定的ZNRecord更新此ZNRecord。此记录中某个字段的值将替换为给定记录中同一字段的值(如果出现)。如果给定记录中有新字段,但此记录中没有,请将该字段添加到此记录中。列表字段和地图字段将被替换为单个条目。
代码示例来源:origin: org.apache.helix/helix-core
@Override public ZNRecord update(ZNRecord currentData) {
if (currentData != null && mergeOnUpdate) {
currentData.update(record);
return currentData;
}
return record;
}
};
代码示例来源:origin: apache/helix
@Override public ZNRecord update(ZNRecord currentData) {
if (currentData != null && mergeOnUpdate) {
currentData.update(record);
return currentData;
}
return record;
}
};
代码示例来源:origin: apache/helix
@POST
@Path("{workflowId}/configs")
public Response updateWorkflowConfig(@PathParam("clusterId") String clusterId,
@PathParam("workflowId") String workflowId, String content) {
ZNRecord record;
TaskDriver driver = getTaskDriver(clusterId);
try {
record = toZNRecord(content);
WorkflowConfig workflowConfig = driver.getWorkflowConfig(workflowId);
if (workflowConfig == null) {
return badRequest(
String.format("WorkflowConfig for workflow %s does not exists!", workflowId));
}
workflowConfig.getRecord().update(record);
driver.updateWorkflow(workflowId, workflowConfig);
} catch (HelixException e) {
return badRequest(
String.format("Failed to update WorkflowConfig for workflow %s", workflowId));
} catch (Exception e) {
return badRequest(String.format("Invalid WorkflowConfig for workflow %s", workflowId));
}
return OK();
}
代码示例来源:origin: org.apache.helix/helix-core
/**
* Merge in a {@link ZNRecordDelta} corresponding to its merge policy
* @param delta
*/
void merge(ZNRecordDelta delta) {
if (delta.getMergeOperation() == MergeOperation.ADD) {
merge(delta.getRecord());
} else if (delta.getMergeOperation() == MergeOperation.SUBTRACT) {
subtract(delta.getRecord());
} else if (delta.getMergeOperation() == MergeOperation.UPDATE) {
update(delta.getRecord());
}
}
代码示例来源:origin: apache/helix
/**
* Merge in a {@link ZNRecordDelta} corresponding to its merge policy
* @param delta
*/
void merge(ZNRecordDelta delta) {
if (delta.getMergeOperation() == MergeOperation.ADD) {
merge(delta.getRecord());
} else if (delta.getMergeOperation() == MergeOperation.SUBTRACT) {
subtract(delta.getRecord());
} else if (delta.getMergeOperation() == MergeOperation.UPDATE) {
update(delta.getRecord());
}
}
内容来源于网络,如有侵权,请联系作者删除!