當前位置: 首頁>>代碼示例>>Java>>正文


Java StormTopology.get_spouts方法代碼示例

本文整理匯總了Java中backtype.storm.generated.StormTopology.get_spouts方法的典型用法代碼示例。如果您正苦於以下問題:Java StormTopology.get_spouts方法的具體用法?Java StormTopology.get_spouts怎麽用?Java StormTopology.get_spouts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在backtype.storm.generated.StormTopology的用法示例。


在下文中一共展示了StormTopology.get_spouts方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: componentType

import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
public static String componentType(StormTopology topology, String id) {
	Map<String, Bolt> bolts = topology.get_bolts();
	Map<String, SpoutSpec> spouts = topology.get_spouts();
	String type = "";
	if (bolts.containsKey(id)) {
		type = BOLT_STR;
	} else if (spouts.containsKey(id)) {
		type = SPOUT_STR;
	}
	return type;
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:12,代碼來源:UIUtils.java

示例2: setSpoutInfo

import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
private int setSpoutInfo(StormTopology oldTopology, StormTopology newTopology, int cnt, StormClusterState clusterState) throws Exception {
    Map<String, SpoutSpec> oldSpouts = oldTopology.get_spouts();
    Map<String, SpoutSpec> spouts = newTopology.get_spouts();
    for (Entry<String, SpoutSpec> entry : oldSpouts.entrySet()) {
        String spoutName = entry.getKey();
        SpoutSpec oldSpout = entry.getValue();
        SpoutSpec spout = spouts.get(spoutName);
        if (oldSpout.get_common().get_parallelism_hint() > spout.get_common().get_parallelism_hint()) {
            int removedTaskNum = oldSpout.get_common().get_parallelism_hint() - spout.get_common().get_parallelism_hint();
            TreeSet<Integer> taskIds = new TreeSet<Integer>(clusterState.task_ids_by_componentId(topologyid, spoutName));
            Iterator<Integer> descendIterator = taskIds.descendingIterator();
            while (--removedTaskNum >= 0) {
                int taskId = descendIterator.next();
                removeTask(topologyid, taskId, clusterState);
                LOG.info("Remove spout task, taskId=" + taskId + " for " + spoutName);
            }

        } else if (oldSpout.get_common().get_parallelism_hint() == spout.get_common().get_parallelism_hint()) {
            continue;
        } else {
            int delta = spout.get_common().get_parallelism_hint() - oldSpout.get_common().get_parallelism_hint();
            Map<Integer, TaskInfo> taskInfoMap = new HashMap<Integer, TaskInfo>();

            for (int i = 1; i <= delta; i++) {
                cnt++;
                TaskInfo taskInfo = new TaskInfo((String) entry.getKey(), "spout");
                taskInfoMap.put(cnt, taskInfo);
                newTasks.add(cnt);
                LOG.info("Setup new spout task, taskId=" + cnt + " for " + spoutName);
            }
            clusterState.add_task(topologyid, taskInfoMap);
        }
    }

    return cnt;
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:37,代碼來源:DoRebalanceTransitionCallback.java

示例3: _asGraph

import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
private ListenableDirectedGraph<NamedNode, DefaultEdge> _asGraph(StormTopology t) {
	final Map<String, Bolt> bolts = t.get_bolts();
	final Map<String, SpoutSpec> spouts = t.get_spouts();
	final ListenableDirectedGraph<NamedNode, DefaultEdge> ret = new ListenableDirectedGraph<NamedNode, DefaultEdge>(
			DefaultEdge.class);

	createSpouts(spouts, ret);
	createBolts(bolts, ret);
	createConnections(bolts, ret);
	return ret;
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:12,代碼來源:StormGraphCreator.java


注:本文中的backtype.storm.generated.StormTopology.get_spouts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。