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


Java ComponentCommon.get_parallelism_hint方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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();

    // 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:alibaba,项目名称:jstorm,代码行数:36,代码来源:NimbusUtils.java

示例7: StormProcessor

import backtype.storm.generated.ComponentCommon; //导入方法依赖的package包/类
/**
 * Creates a processor for Storm.
 * 
 * @param name the name
 * @param common the common instance carrying additional information
 * @param executor runtime information
 * @param spout is this a spout or a bolt?
 */
protected StormProcessor(String name, ComponentCommon common, ExecutorSummary executor, boolean spout) {
    super(name, common.get_parallelism_hint(), toTasks(executor));
    this.spout = spout;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:13,代码来源:Utils.java


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