org.apache.storm.generated.Bolt类的使用及代码示例

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

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

Bolt介绍

暂无

代码示例

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

public static Map<String, NormalizedResourceRequest> getBoltsResources(StormTopology topology, Map<String, Object> topologyConf) {
  Map<String, NormalizedResourceRequest> boltResources = new HashMap<>();
  if (topology.get_bolts() != null) {
    for (Map.Entry<String, Bolt> bolt : topology.get_bolts().entrySet()) {
      NormalizedResourceRequest topologyResources = new NormalizedResourceRequest(bolt.getValue().get_common(),
          topologyConf, bolt.getKey());
      if (LOG.isTraceEnabled()) {
        LOG.trace("Turned {} into {}", bolt.getValue().get_common().get_json_conf(), topologyResources);
      }
      boltResources.put(bolt.getKey(), topologyResources);
    }
  }
  return boltResources;
}

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

public Bolt deepCopy() {
 return new Bolt(this);
}

代码示例来源: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

public void setFieldValue(_Fields field, java.lang.Object value) {
 switch (field) {
 case BOLT_OBJECT:
  if (value == null) {
   unset_bolt_object();
  } else {
   set_bolt_object((ComponentObject)value);
  }
  break;
 case COMMON:
  if (value == null) {
   unset_common();
  } else {
   set_common((ComponentCommon)value);
  }
  break;
 }
}

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

/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
 if (field == null) {
  throw new java.lang.IllegalArgumentException();
 }
 switch (field) {
 case BOLT_OBJECT:
  return is_set_bolt_object();
 case COMMON:
  return is_set_common();
 }
 throw new java.lang.IllegalStateException();
}

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

for (Entry<String, StreamInfo> streamEntry : boltEntry.getValue().get_common().get_streams().entrySet()) {
    String stream = streamEntry.getKey();
    StreamInfo info = streamEntry.getValue();
topology.put_to_bolts(Utils.uuid(), new Bolt(Thrift.serializeComponentObject(capturer),
                       Thrift.prepareComponentCommon(captureBoltInputs, new HashMap<>(), null)));
return new CapturedTopology<>(topology, capturer);

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

static Map<String, Map<String, Double>> getBoltsResources(StormTopology topology, Map<String, Object> topologyConf) {
  Map<String, Map<String, Double>> boltResources = new HashMap<>();
  if (topology.get_bolts() != null) {
    for (Map.Entry<String, Bolt> bolt : topology.get_bolts().entrySet()) {
      Map<String, Double> topologyResources = parseResources(bolt.getValue().get_common().get_json_conf());
      checkInitialization(topologyResources, bolt.getValue().toString(), topologyConf);
      boltResources.put(bolt.getKey(), topologyResources);
    }
  }
  return boltResources;
}

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

_val100 = new Bolt();
_val100.read(iprot);
struct.bolts.put(_key99, _val100);

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

public void validate() throws org.apache.storm.thrift.TException {
 // check for required fields
 if (!is_set_bolt_object()) {
  throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'bolt_object' is unset! Struct:" + toString());
 }
 if (!is_set_common()) {
  throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'common' is unset! Struct:" + toString());
 }
 // check for sub-struct validity
 if (common != null) {
  common.validate();
 }
}

代码示例来源: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: stackoverflow.com

MockOutputCollector c = new MockOutputCollector();
Bolt b = new Bolt();
b.prepare(c,null,null);
MockTuple tuple = new MockTuple(fields,Arrays.aslist({"a,b,c"}));
b.execute(tuple);
List result = c.getEmittedTuples().get(0);

代码示例来源: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

@Override
public boolean equals(java.lang.Object that) {
 if (that == null)
  return false;
 if (that instanceof Bolt)
  return this.equals((Bolt)that);
 return false;
}

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

@Test
public void testGetComponentCommonWithWorkerHook() {
  StormTopology stormTopology = genereateStormTopology(true);
  ComponentCommon componentCommon = ThriftTopologyUtils.getComponentCommon(stormTopology, "bolt-1");
  Assert.assertEquals(
    "We expect to get bolt-1's common",
    new Bolt().get_common(),
    componentCommon);
}

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

public static Map<String, Map<String, Double>> getBoltsResources(StormTopology topology, Map topologyConf) {
  Map<String, Map<String, Double>> boltResources = new HashMap<String, Map<String, Double>>();
  if (topology.get_bolts() != null) {
    for (Map.Entry<String, Bolt> bolt : topology.get_bolts().entrySet()) {
      Map<String, Double> topology_resources = parseResources(bolt.getValue().get_common().get_json_conf());
      checkIntialization(topology_resources, bolt.getValue().toString(), topologyConf);
      boltResources.put(bolt.getKey(), topology_resources);
    }
  }
  return boltResources;
}

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

_val50 = new Bolt();
_val50.read(iprot);
struct.bolts.put(_key49, _val50);

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

public void setFieldValue(_Fields field, Object value) {
 switch (field) {
 case BOLT_OBJECT:
  if (value == null) {
   unset_bolt_object();
  } else {
   set_bolt_object((ComponentObject)value);
  }
  break;
 case COMMON:
  if (value == null) {
   unset_common();
  } else {
   set_common((ComponentCommon)value);
  }
  break;
 }
}

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

@Override
public int hashCode() {
 int hashCode = 1;
 hashCode = hashCode * 8191 + ((is_set_bolt_object()) ? 131071 : 524287);
 if (is_set_bolt_object())
  hashCode = hashCode * 8191 + bolt_object.hashCode();
 hashCode = hashCode * 8191 + ((is_set_common()) ? 131071 : 524287);
 if (is_set_common())
  hashCode = hashCode * 8191 + common.hashCode();
 return hashCode;
}

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

public void validate() throws org.apache.thrift.TException {
 // check for required fields
 if (!is_set_bolt_object()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'bolt_object' is unset! Struct:" + toString());
 }
 if (!is_set_common()) {
  throw new org.apache.thrift.protocol.TProtocolException("Required field 'common' is unset! Struct:" + toString());
 }
 // check for sub-struct validity
 if (common != null) {
  common.validate();
 }
}

代码示例来源: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));
}

相关文章