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