public Object getFieldValue(_Fields field) { switch (field) { case SPOUT_OBJECT: return get_spout_object(); case COMMON: return get_common(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case SPOUT_OBJECT: return get_spout_object(); case COMMON: return get_common(); } throw new IllegalStateException(); }
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); } }
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); }
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<>(clusterState.task_ids_by_componentId(topologyId, spoutName)); Iterator<Integer> descendIterator = taskIds.descendingIterator(); 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<>();
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); } }
common = ((SpoutSpec) obj).get_common();
componentType = "bolt"; } else if (obj instanceof SpoutSpec) { common = ((SpoutSpec) obj).get_common(); componentType = "spout"; } else if (obj instanceof StateSpoutSpec) {
private static void validate_component_inputs(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; if (!spec.get_common().get_inputs().isEmpty()) { throw new InvalidTopologyException("May not declare inputs for a spout"); } } if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; if (!spec.get_common().get_inputs().isEmpty()) { throw new InvalidTopologyException("May not declare inputs for a spout"); } } }
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); }
static void validate_component_inputs(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; if (!spec.get_common().get_inputs().isEmpty()) { throw new InvalidTopologyException( "May not declare inputs for a spout"); } } if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; if (!spec.get_common().get_inputs().isEmpty()) { throw new InvalidTopologyException( "May not declare inputs for a spout"); } } }
private static void add_component_system_streams(Object obj) { ComponentCommon common = null; if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; common = spec.get_common(); } if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; common = spec.get_common(); } if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; common = spec.get_common(); } if (common != null) { StreamInfo sinfo = Thrift.outputFields(sysEventFields); common.put_to_streams(SYSTEM_STREAM_ID, sinfo); } }
common = ((SpoutSpec) component).get_common(); if (fromConf) { Integer paraNum = ConfigExtension.getSpoutParallelism(stormConf, componentName);
common = ((SpoutSpec) component).get_common();
static void add_component_system_streams(Object obj) { ComponentCommon common=null; if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; common=spec.get_common(); } if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; common=spec.get_common(); } if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; common=spec.get_common(); } if(common!=null) { StreamInfo sinfo=Thrift.outputFields(sysEventFields); common.put_to_streams(SYSTEM_STREAM_ID,sinfo); } }
ComponentCommon common = bolt.get_common(); List<String> initList = JStormUtils.mk_list("id", "init-val", "spout-task"); common.put_to_streams(ACKER_INIT_STREAM_ID, Thrift.outputFields(initList));
static void validate_component(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id)) { throw new InvalidTopologyException(id + " is not a valid component id"); } } } if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id)) { throw new InvalidTopologyException(id + " is not a valid component id"); } } } if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id)) { throw new InvalidTopologyException(id + " is not a valid component id"); } } } }
private static void validate_component(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else { throw new InvalidTopologyException("Unknown component type"); } }
ComponentCommon common = bolt.get_common(); List<String> initList = StormUtils.mk_list("id", "init-val", "spout-task"); common.put_to_streams(ACKER_INIT_STREAM_ID,Thrift.outputFields(initList));
ComponentCommon common = spout.get_common(); List<String> fields = JStormUtils.mk_list(TopologyMaster.FIELD_METRIC_WORKER, TopologyMaster.FIELD_METRIC_METRICS); common.put_to_streams(TOPOLOGY_MASTER_METRICS_STREAM_ID, Thrift.directOutputFields(fields));