public SynchronizedStormDataSource(
     ComponentProperties cp,
     List<String> allCompNames,
     ArrayList<Type> tupleTypes,
     int hierarchyPosition,
     int parallelism,
     int keyIndex,
     boolean isPartitioner,
     TopologyBuilder builder,
     TopologyKiller killer,
     Config conf,
     int numOfTuplesThreshold) {
   super(cp, allCompNames, hierarchyPosition, isPartitioner, conf);
   _numOfTuplesThreshold = numOfTuplesThreshold;
   _keyIndex = keyIndex;
   _name = cp.getName();
   _aggBatchOutputMillis = cp.getBatchOutputMillis();
   _operatorChain = cp.getChainOperator();
   _schema = tupleTypes;
   _frequentSet = new HashSet<Integer>();
   if (getHierarchyPosition() == FINAL_COMPONENT && (!MyUtilities.isAckEveryTuple(conf)))
     killer.registerComponent(this, parallelism);
   builder.setSpout(getID(), this, parallelism);
   if (MyUtilities.isAckEveryTuple(conf)) killer.registerComponent(this, parallelism);
 }
Esempio n. 2
0
  public StormOperator(
      ArrayList<Component> parentEmitters,
      ComponentProperties cp,
      List<String> allCompNames,
      int hierarchyPosition,
      TopologyBuilder builder,
      TopologyKiller killer,
      Config conf) {
    super(cp, allCompNames, hierarchyPosition, conf);

    _aggBatchOutputMillis = cp.getBatchOutputMillis();

    final int parallelism = SystemParameters.getInt(conf, getID() + "_PAR");

    // if(parallelism > 1 && distinct != null){
    // throw new RuntimeException(_componentName +
    // ": Distinct operator cannot be specified for multiThreaded bolts!");
    // }
    _operatorChain = cp.getChainOperator();

    InputDeclarer currentBolt = builder.setBolt(getID(), this, parallelism);

    _fullHashList = cp.getFullHashList();

    for (StormEmitter parentEmitter : parentEmitters) {

      // This is specific only to the Synchronized operator
      // add the shuffling stream grouping
      if (parentEmitter instanceof SignaledDataSourceComponentInterface) {
        final String[] emitterIDs = parentEmitter.getEmitterIDs();
        for (final String emitterID : emitterIDs)
          currentBolt.shuffleGrouping(
              emitterID, SynchronizedStormDataSourceInterface.SHUFFLE_GROUPING_STREAMID);
      }

      if (MyUtilities.isManualBatchingMode(getConf()))
        currentBolt =
            MyUtilities.attachEmitterBatch(conf, _fullHashList, currentBolt, parentEmitter);
      else
        currentBolt =
            MyUtilities.attachEmitterHash(conf, _fullHashList, currentBolt, parentEmitter);
    }

    if (getHierarchyPosition() == FINAL_COMPONENT && (!MyUtilities.isAckEveryTuple(conf)))
      killer.registerComponent(this, parallelism);

    if (cp.getPrintOut() && _operatorChain.isBlocking())
      currentBolt.allGrouping(killer.getID(), SystemParameters.DUMP_RESULTS_STREAM);
  }