• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ComponentCommon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中backtype.storm.generated.ComponentCommon的典型用法代码示例。如果您正苦于以下问题:Java ComponentCommon类的具体用法?Java ComponentCommon怎么用?Java ComponentCommon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ComponentCommon类属于backtype.storm.generated包,在下文中一共展示了ComponentCommon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: IdDictionary

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public IdDictionary(StormTopology topology) {
	List<String> componentNames = new ArrayList<String>(topology
			.get_spouts().keySet());
	componentNames.addAll(topology.get_bolts().keySet());
	componentNames.addAll(topology.get_state_spouts().keySet());

	for (String name : componentNames) {
		ComponentCommon common = Utils.getComponentCommon(topology,
				name);
		List<String> streams = new ArrayList<String>(common
				.get_streams().keySet());
		streamNametoId.put(name, idify(streams));
		streamIdToName.put(name,
				Utils.reverseMap(streamNametoId.get(name)));
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:17,代码来源:SerializationFactory.java


示例2: getComponentCommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static ComponentCommon getComponentCommon(StormTopology topology,
		String componentId) {
	for (StormTopology._Fields f : StormTopology.metaDataMap.keySet()) {
		Map<String, Object> componentMap = (Map<String, Object>) topology
				.getFieldValue(f);
		if (componentMap.containsKey(componentId)) {
			Object component = componentMap.get(componentId);
			if (component instanceof Bolt) {
				return ((Bolt) component).get_common();
			}
			if (component instanceof SpoutSpec) {
				return ((SpoutSpec) component).get_common();
			}
			if (component instanceof StateSpoutSpec) {
				return ((StateSpoutSpec) component).get_common();
			}
			throw new RuntimeException(
					"Unreachable code! No get_common conversion for component "
							+ component);
		}
	}
	throw new IllegalArgumentException(
			"Could not find component common for " + componentId);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:25,代码来源:ThriftTopologyUtils.java


示例3: maxTopologyMessageTimeout

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public int maxTopologyMessageTimeout() {
	Integer max = Utils.getInt(_stormConf
			.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
	for (String spout : getRawTopology().get_spouts().keySet()) {
		ComponentCommon common = getComponentCommon(spout);
		String jsonConf = common.get_json_conf();
		if (jsonConf != null) {
			Map conf = (Map) Utils.from_json(jsonConf);
			Object comp = conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS);
			if (comp != null) {
				max = Math.max(Utils.getInt(comp), max);
			}
		}
	}
	return max;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:17,代码来源:GeneralTopologyContext.java


示例4: createStreams

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
/**
 * Creates the streams for <code>common</code>.
 * 
 * @param procs already known processors
 * @param originName the name of the origin processor
 * @param common the common instance to create streams for
 * @param cfg configuration
 * @param hwAlgType the hardware algorithm type
 * @param mapping the name mapping
 */
private static void createStreams(Map<String, StormProcessor> procs, String originName, 
    ComponentCommon common, Configuration cfg, IDatatype hwAlgType, INameMapping mapping) {
    StormProcessor target = getProcessor(procs, originName);
    if (null != target) {
        for (Map.Entry<GlobalStreamId, Grouping> grouping : common.get_inputs().entrySet()) {
            GlobalStreamId id = grouping.getKey();
            StormProcessor origin = getProcessor(procs, mapName(mapping, id.get_componentId()));
            if (null != origin) {
                if (!leaveOutConnection(mapping, origin, cfg, hwAlgType) && !origin.hasOutputTo(target)) {
                    Stream stream = new Stream(id.get_streamId(), origin, target);
                    origin.addOutput(stream);
                    target.addInput(stream);
                }
            }
        }
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:28,代码来源:Utils.java


示例5: createProcessors

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
/**
 * Creates processors for a set of <code>entries</code> (bolts or spouts).
 * 
 * @param <T> the entry type of <code>entries</code>
 * @param mapping the name mapping
 * @param executors the actual executors
 * @param entries the entries to process
 * @param procs the processors to modify as a side effect
 * @param spout are we processing spouts
 */
private static <T> void createProcessors(INameMapping mapping, Map<String, ExecutorSummary> executors, 
    Set<Map.Entry<String, T>> entries, Map<String, StormProcessor> procs, boolean spout) {
    for (Map.Entry<String, T> entry : entries) {
        String name = mapName(mapping, entry);
        ExecutorSummary executor = getNonInternalExecutor(executors, entry);
        if (null != name && null != executor) { // avoid Storm internal streams for now
            ComponentCommon common = getComponentCommon(entry.getValue());
            if (null != common) {
                StormProcessor proc = procs.get(name);
                if (null != proc) {
                    proc.update(executor);
                } else {
                    procs.put(name, new StormProcessor(name, common, executor, spout));
                }
            }
        }
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:29,代码来源:Utils.java


示例6: getComponentCommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static ComponentCommon getComponentCommon(StormTopology topology, String componentId) {
    for(StormTopology._Fields f: StormTopology.metaDataMap.keySet()) {
        Map<String, Object> componentMap = (Map<String, Object>) topology.getFieldValue(f);
        if(componentMap.containsKey(componentId)) {
            Object component = componentMap.get(componentId);
            if(component instanceof Bolt) {
                return ((Bolt) component).get_common();
            }
            if(component instanceof SpoutSpec) {
                return ((SpoutSpec) component).get_common();
            }
            if(component instanceof StateSpoutSpec) {
                return ((StateSpoutSpec) component).get_common();
            }
            throw new RuntimeException("Unreachable code! No get_common conversion for component " + component);
        }
    }
    throw new IllegalArgumentException("Could not find component common for " + componentId);
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:20,代码来源:ThriftTopologyUtils.java


示例7: initCommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
protected void initCommon(String id, IComponent component, Number parallelism) throws IllegalArgumentException {
    ComponentCommon common = new ComponentCommon();
    common.set_inputs(new HashMap<GlobalStreamId, Grouping>());
    if (parallelism != null) {
        int dop = parallelism.intValue();
        if(dop < 1) {
            throw new IllegalArgumentException("Parallelism must be positive.");
        }
        common.set_parallelism_hint(dop);
    } else {
        common.set_parallelism_hint(1);
    }
    Map conf = component.getComponentConfiguration();
    if(conf!=null) common.set_json_conf(JSONValue.toJSONString(conf));
    _commons.put(id, common);
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:17,代码来源:TopologyBuilder.java


示例8: parallelismHint

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static int parallelismHint(ComponentCommon component_common) {
	int phint = component_common.get_parallelism_hint();
	if (!component_common.is_set_parallelism_hint()) {
		phint = 1;
	}
	return phint;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:Thrift.java


示例9: mkComponentcommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
private static ComponentCommon mkComponentcommon(
		Map<GlobalStreamId, Grouping> inputs,
		HashMap<String, StreamInfo> output_spec, Integer parallelism_hint) {
	ComponentCommon ret = new ComponentCommon(inputs, output_spec);
	if (parallelism_hint != null) {
		ret.set_parallelism_hint(parallelism_hint);
	}
	return ret;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:Thrift.java


示例10: mkBolt

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static Bolt mkBolt(Map<GlobalStreamId, Grouping> inputs,
		IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
	ComponentCommon common = mkComponentcommon(inputs, output, p);
	byte[] boltSer = Utils.serialize(bolt);
	ComponentObject component = ComponentObject.serialized_java(boltSer);
	return new Bolt(component, common);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:Thrift.java


示例11: computeWorkerNum

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
@SuppressWarnings("unused")
private int computeWorkerNum() {
	Integer settingNum = JStormUtils.parseInt(stormConf
			.get(Config.TOPOLOGY_WORKERS));

	int hintSum = 0;

	Map<String, Object> components = ThriftTopologyUtils
			.getComponents(sysTopology);
	for (Entry<String, Object> entry : components.entrySet()) {
		String componentName = entry.getKey();
		Object component = entry.getValue();

		ComponentCommon common = null;
		if (component instanceof Bolt) {
			common = ((Bolt) component).get_common();
		}
		if (component instanceof SpoutSpec) {
			common = ((SpoutSpec) component).get_common();
		}
		if (component instanceof StateSpoutSpec) {
			common = ((StateSpoutSpec) component).get_common();
		}

		int hint = common.get_parallelism_hint();
		hintSum += hint;
	}

	if (settingNum == null) {
		return hintSum;
	} else {
		return Math.min(settingNum, hintSum);
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:35,代码来源:DefaultTopologyAssignContext.java


示例12: componentParalism

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static Integer componentParalism(Map stormConf,
		ComponentCommon common) {
	Map mergeMap = new HashMap();
	mergeMap.putAll(stormConf);

	String jsonConfString = common.get_json_conf();
	if (jsonConfString != null) {
		Map componentMap = (Map) JStormUtils.from_json(jsonConfString);
		mergeMap.putAll(componentMap);
	}

	Integer taskNum = common.get_parallelism_hint();
	if (taskNum == null) {
		taskNum = Integer.valueOf(1);
	}

	// don't get taskNum from component configuraiton
	// skip .setTaskNum
	// Integer taskNum = null;
	// Object taskNumObject = mergeMap.get(Config.TOPOLOGY_TASKS);
	// if (taskNumObject != null) {
	// taskNum = JStormUtils.parseInt(taskNumObject);
	// } else {
	// taskNum = common.get_parallelism_hint();
	// if (taskNum == null) {
	// taskNum = Integer.valueOf(1);
	// }
	// }

	Object maxTaskParalismObject = mergeMap
			.get(Config.TOPOLOGY_MAX_TASK_PARALLELISM);
	if (maxTaskParalismObject == null) {
		return taskNum;
	} else {
		int maxTaskParalism = JStormUtils.parseInt(maxTaskParalismObject);

		return Math.min(maxTaskParalism, taskNum);
	}

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


示例13: add_system_components

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
@SuppressWarnings("unused")
public static StormTopology add_system_components(StormTopology topology) {
	// generate inputs
	Map<GlobalStreamId, Grouping> inputs = new HashMap<GlobalStreamId, Grouping>();

	// generate outputs
	HashMap<String, StreamInfo> outputs = new HashMap<String, StreamInfo>();
	ArrayList<String> fields = new ArrayList<String>();

	outputs.put(Constants.SYSTEM_TICK_STREAM_ID,
			Thrift.outputFields(JStormUtils.mk_list("rate_secs")));
	outputs.put(Constants.METRICS_TICK_STREAM_ID,
			Thrift.outputFields(JStormUtils.mk_list("interval")));
	outputs.put(Constants.CREDENTIALS_CHANGED_STREAM_ID,
			Thrift.outputFields(JStormUtils.mk_list("creds")));

	ComponentCommon common = new ComponentCommon(inputs, outputs);

	IBolt ackerbolt = new SystemBolt();

	Bolt bolt = Thrift.mkBolt(inputs, ackerbolt, outputs,
			Integer.valueOf(0));

	topology.put_to_bolts(Constants.SYSTEM_COMPONENT_ID, bolt);

	add_system_streams(topology);

	return topology;

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


示例14: getComponentMap

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
/**
 * get the component's configuration
 * 
 * @param topology_context
 * @param task_id
 * @return component's configurations
 */
public static Map getComponentMap(DefaultTopologyAssignContext context,
		Integer task) {
	String componentName = context.getTaskToComponent().get(task);
	ComponentCommon componentCommon = ThriftTopologyUtils
			.getComponentCommon(context.getSysTopology(), componentName);

	Map componentMap = (Map) JStormUtils.from_json(componentCommon
			.get_json_conf());
	if (componentMap == null) {
		componentMap = Maps.newHashMap();
	}
	return componentMap;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:21,代码来源:Common.java


示例15: getComponentCommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static ComponentCommon getComponentCommon(StormTopology topology,
		String id) {
	if (topology.get_spouts().containsKey(id)) {
		return topology.get_spouts().get(id).get_common();
	}
	if (topology.get_bolts().containsKey(id)) {
		return topology.get_bolts().get(id).get_common();
	}
	if (topology.get_state_spouts().containsKey(id)) {
		return topology.get_state_spouts().get(id).get_common();
	}
	throw new IllegalArgumentException("Could not find component with id "
			+ id);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:15,代码来源:Utils.java


示例16: getComponentCommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
private ComponentCommon getComponentCommon(String id, IComponent component) {
	ComponentCommon ret = new ComponentCommon(_commons.get(id));

	OutputFieldsGetter getter = new OutputFieldsGetter();
	component.declareOutputFields(getter);
	ret.set_streams(getter.getFieldsDeclaration());
	return ret;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:9,代码来源:TopologyBuilder.java


示例17: initCommon

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
private void initCommon(String id, IComponent component, Number parallelism) {
	ComponentCommon common = new ComponentCommon();
	common.set_inputs(new HashMap<GlobalStreamId, Grouping>());
	if (parallelism != null)
		common.set_parallelism_hint(parallelism.intValue());
	else {
	    common.set_parallelism_hint(Integer.valueOf(1));
	}
	Map conf = component.getComponentConfiguration();
	if (conf != null)
		common.set_json_conf(Utils.to_json(conf));
	_commons.put(id, common);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:14,代码来源:TopologyBuilder.java


示例18: computeWorkerNum

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
private int computeWorkerNum() {
	Integer settingNum = JStormUtils.parseInt(stormConf
			.get(Config.TOPOLOGY_WORKERS));

	int hintSum = 0;

	Map<String, Object> components = ThriftTopologyUtils
			.getComponents(sysTopology);
	for (Entry<String, Object> entry : components.entrySet()) {
		String componentName = entry.getKey();
		Object component = entry.getValue();

		ComponentCommon common = null;
		if (component instanceof Bolt) {
			common = ((Bolt) component).get_common();
		}
		if (component instanceof SpoutSpec) {
			common = ((SpoutSpec) component).get_common();
		}
		if (component instanceof StateSpoutSpec) {
			common = ((StateSpoutSpec) component).get_common();
		}

		int hint = common.get_parallelism_hint();
		hintSum += hint;
	}

	if (settingNum == null) {
		return hintSum;
	} else {
		return Math.min(settingNum, hintSum);
	}
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:34,代码来源:DefaultTopologyAssignContext.java


示例19: componentParalism

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static Integer componentParalism(Map stormConf, ComponentCommon common) {
    Map mergeMap = new HashMap();
    mergeMap.putAll(stormConf);

    String jsonConfString = common.get_json_conf();
    if (jsonConfString != null) {
        Map componentMap = (Map) JStormUtils.from_json(jsonConfString);
        mergeMap.putAll(componentMap);
    }

    Integer taskNum = common.get_parallelism_hint();
    if (taskNum == null) {
        taskNum = Integer.valueOf(1);
    }

    // don't get taskNum from component configuraiton
    // skip .setTaskNum
    // Integer taskNum = null;
    // Object taskNumObject = mergeMap.get(Config.TOPOLOGY_TASKS);
    // if (taskNumObject != null) {
    // taskNum = JStormUtils.parseInt(taskNumObject);
    // } else {
    // taskNum = common.get_parallelism_hint();
    // if (taskNum == null) {
    // taskNum = Integer.valueOf(1);
    // }
    // }

    Object maxTaskParalismObject = mergeMap.get(Config.TOPOLOGY_MAX_TASK_PARALLELISM);
    if (maxTaskParalismObject == null) {
        return taskNum;
    } else {
        int maxTaskParalism = JStormUtils.parseInt(maxTaskParalismObject);

        return Math.min(maxTaskParalism, taskNum);
    }

}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:39,代码来源:NimbusUtils.java


示例20: add_system_components

import backtype.storm.generated.ComponentCommon; //导入依赖的package包/类
public static StormTopology add_system_components(StormTopology topology) {
	// generate inputs
	Map<GlobalStreamId, Grouping> inputs = new HashMap<GlobalStreamId, Grouping>();

	// generate outputs
	HashMap<String, StreamInfo> outputs = new HashMap<String, StreamInfo>();
	ArrayList<String> fields = new ArrayList<String>();

	outputs.put(Constants.SYSTEM_TICK_STREAM_ID,
			Thrift.outputFields(JStormUtils.mk_list("rate_secs")));
	outputs.put(Constants.METRICS_TICK_STREAM_ID,
			Thrift.outputFields(JStormUtils.mk_list("interval")));
	outputs.put(Constants.CREDENTIALS_CHANGED_STREAM_ID,
			Thrift.outputFields(JStormUtils.mk_list("creds")));

	ComponentCommon common = new ComponentCommon(inputs, outputs);

	IBolt ackerbolt = new SystemBolt();

	Bolt bolt = Thrift.mkBolt(inputs, ackerbolt, outputs,
			Integer.valueOf(0));

	topology.put_to_bolts(Constants.SYSTEM_COMPONENT_ID, bolt);

	add_system_streams(topology);

	return topology;

}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:30,代码来源:Common.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GeoEventDefinition类代码示例发布时间:2022-05-22
下一篇:
Java XmlSlurper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap