本文整理汇总了Java中backtype.storm.generated.TopologyInfo.set_userDefMetric方法的典型用法代码示例。如果您正苦于以下问题:Java TopologyInfo.set_userDefMetric方法的具体用法?Java TopologyInfo.set_userDefMetric怎么用?Java TopologyInfo.set_userDefMetric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.generated.TopologyInfo
的用法示例。
在下文中一共展示了TopologyInfo.set_userDefMetric方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTopologyInfo
import backtype.storm.generated.TopologyInfo; //导入方法依赖的package包/类
/**
* Get TopologyInfo, it contain all data of the topology running status
*
* @return TopologyInfo
*/
public TopologyInfo getTopologyInfo(String topologyId, StormBase base)
throws Exception {
StormClusterState stormClusterState = data.getStormClusterState();
TopologyInfo topologyInfo = new TopologyInfo();
topologyInfo.set_id(topologyId);
topologyInfo.set_name(base.getStormName());
topologyInfo.set_uptime_secs(TimeUtils.time_delta(base
.getLanchTimeSecs()));
topologyInfo.set_status(base.getStatusString());
// get topology's Assignment
Assignment assignment = stormClusterState.assignment_info(
topologyId, null);
if (assignment == null) {
throw new TException("Failed to get StormBase from ZK of "
+ topologyId);
}
// get topology's map<taskId, componentId>
Map<Integer, String> taskInfo = Cluster.topology_task_info(
stormClusterState, topologyId);
Map<Integer, TaskSummary> tasks = NimbusUtils.mkTaskSummary(
stormClusterState, assignment, taskInfo, topologyId);
List<TaskSummary> taskSumms = new ArrayList<TaskSummary>();
for (Entry<Integer, TaskSummary> entry : tasks.entrySet()) {
taskSumms.add(entry.getValue());
}
topologyInfo.set_tasks(taskSumms);
List<WorkerSummary> workers = NimbusUtils.mkWorkerSummary(
topologyId, assignment, tasks);
topologyInfo.set_workers(workers);
// get user defined metrics data
List<UserDefMetric> udm = new ArrayList<UserDefMetric>();
udm = getUserDefMetrics(topologyId);
topologyInfo.set_userDefMetric(udm);
return topologyInfo;
}