org.apache.storm.generated.Bolt.get_bolt_object()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.apache.storm.generated.Bolt.get_bolt_object()方法的一些代码示例,展示了Bolt.get_bolt_object()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bolt.get_bolt_object()方法的具体详情如下:
包路径:org.apache.storm.generated.Bolt
类名称:Bolt
方法名:get_bolt_object

Bolt.get_bolt_object介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public java.lang.Object getFieldValue(_Fields field) {
 switch (field) {
 case BOLT_OBJECT:
  return get_bolt_object();
 case COMMON:
  return get_common();
 }
 throw new java.lang.IllegalStateException();
}

代码示例来源:origin: apache/storm

private Object mkTaskObject() {
  StormTopology topology = systemTopologyContext.getRawTopology();
  Map<String, SpoutSpec> spouts = topology.get_spouts();
  Map<String, Bolt> bolts = topology.get_bolts();
  Map<String, StateSpoutSpec> stateSpouts = topology.get_state_spouts();
  Object result;
  ComponentObject componentObject;
  if (spouts.containsKey(componentId)) {
    componentObject = spouts.get(componentId).get_spout_object();
  } else if (bolts.containsKey(componentId)) {
    componentObject = bolts.get(componentId).get_bolt_object();
  } else if (stateSpouts.containsKey(componentId)) {
    componentObject = stateSpouts.get(componentId).get_state_spout_object();
  } else {
    throw new RuntimeException("Could not find " + componentId + " in " + topology);
  }
  result = Utils.getSetComponentObject(componentObject);
  if (result instanceof ShellComponent) {
    if (spouts.containsKey(componentId)) {
      result = new ShellSpout((ShellComponent) result);
    } else {
      result = new ShellBolt((ShellComponent) result);
    }
  }
  if (result instanceof JavaObject) {
    result = Thrift.instantiateJavaObject((JavaObject) result);
  }
  return result;
}

代码示例来源:origin: apache/storm

/**
 * Create a new topology to be tracked.
 * @param origTopo the original topology.
 * @param cluster a cluster that should have been launched with tracking enabled.
 */
public TrackedTopology(StormTopology origTopo, ILocalCluster cluster) {
  LOG.warn("CLUSTER {} - {}", cluster, cluster.getTrackedId());
  this.cluster = cluster;
  lastSpoutCommit = new AtomicInteger(0);
  String id = cluster.getTrackedId();
  topology = origTopo.deepCopy();
  for (Bolt bolt : topology.get_bolts().values()) {
    IRichBolt obj = (IRichBolt) Thrift.deserializeComponentObject(bolt.get_bolt_object());
    bolt.set_bolt_object(Thrift.serializeComponentObject(new BoltTracker(obj, id)));
  }
  for (SpoutSpec spout : topology.get_spouts().values()) {
    IRichSpout obj = (IRichSpout) Thrift.deserializeComponentObject(spout.get_spout_object());
    spout.set_spout_object(Thrift.serializeComponentObject(new SpoutTracker(obj, id)));
  }
}

代码示例来源:origin: org.apache.storm/storm-core

public Object getFieldValue(_Fields field) {
 switch (field) {
 case BOLT_OBJECT:
  return get_bolt_object();
 case COMMON:
  return get_common();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: org.apache.atlas/storm-bridge

private void addTopologyOutputs(StormTopology stormTopology, String topologyOwner, Map stormConf, AtlasEntity topology, AtlasEntityExtInfo entityExtInfo) {
  List<AtlasEntity> outputs   = new ArrayList<>();
  Map<String, Bolt> bolts     = stormTopology.get_bolts();
  Set<String>       boltNames = StormTopologyUtil.getTerminalUserBoltNames(stormTopology);
  for (String boltName : boltNames) {
    Serializable instance = Utils.javaDeserialize(bolts.get(boltName).get_bolt_object().get_serialized_java(), Serializable.class);
    String       dsType   = instance.getClass().getSimpleName();
    AtlasEntity  dsEntity = addDataSet(dsType, topologyOwner, instance, stormConf, entityExtInfo);
    if (dsEntity != null) {
      outputs.add(dsEntity);
    }
  }
  topology.setAttribute("outputs", AtlasTypeUtil.getAtlasObjectIds(outputs));
}

代码示例来源:origin: org.apache.atlas/storm-bridge

private AtlasEntity createBoltInstance(String boltName, Bolt stormBolt) {
  AtlasEntity         bolt          = new AtlasEntity(StormDataTypes.STORM_BOLT.getName());
  Serializable        instance      = Utils.javaDeserialize(stormBolt.get_bolt_object().get_serialized_java(), Serializable.class);
  Map<String, String> flatConfigMap = StormTopologyUtil.getFieldValues(instance, true, null);
  bolt.setAttribute(AtlasClient.NAME, boltName);
  bolt.setAttribute("driverClass", instance.getClass().getName());
  bolt.setAttribute("conf", flatConfigMap);
  return bolt;
}

相关文章