当前位置: 首页>>代码示例>>Java>>正文


Java TopologyInfo.set_userDefMetric方法代码示例

本文整理汇总了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;

}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:50,代码来源:ServiceHandler.java


注:本文中的backtype.storm.generated.TopologyInfo.set_userDefMetric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。