Ejemplo n.º 1
0
  private void setConfigOutputs() {
    setSerializers();
    setCollector();

    int numberOfOutputs = configuration.getNumberOfOutputs();
    bufferTimeout = configuration.getBufferTimeout();

    for (int i = 0; i < numberOfOutputs; i++) {
      setPartitioner(i, outputs);
    }
  }
Ejemplo n.º 2
0
  void setPartitioner(
      int outputNumber, List<RecordWriter<SerializationDelegate<StreamRecord<OUT>>>> outputs) {
    StreamPartitioner<OUT> outputPartitioner = null;

    try {
      outputPartitioner = configuration.getPartitioner(outputNumber);

    } catch (Exception e) {
      throw new StreamComponentException(
          "Cannot deserialize partitioner for "
              + streamComponent.getName()
              + " with "
              + outputNumber
              + " outputs",
          e);
    }

    RecordWriter<SerializationDelegate<StreamRecord<OUT>>> output;

    if (bufferTimeout > 0) {
      output =
          new StreamRecordWriter<SerializationDelegate<StreamRecord<OUT>>>(
              streamComponent, outputPartitioner, bufferTimeout);
    } else {
      output =
          new RecordWriter<SerializationDelegate<StreamRecord<OUT>>>(
              streamComponent, outputPartitioner);
    }

    outputs.add(output);
    List<String> outputName = configuration.getOutputName(outputNumber);

    if (collector != null) {
      collector.addOutput(output, outputName);
    }

    if (LOG.isTraceEnabled()) {
      LOG.trace(
          "Partitioner set: "
              + outputPartitioner.getClass().getSimpleName()
              + " with "
              + outputNumber
              + " outputs");
    }
  }
Ejemplo n.º 3
0
 void setSerializers() {
   outTypeInfo = configuration.getTypeInfoOut1();
   outSerializer = new StreamRecordSerializer<OUT>(outTypeInfo);
   outSerializationDelegate = new SerializationDelegate<StreamRecord<OUT>>(outSerializer);
   outSerializationDelegate.setInstance(outSerializer.createInstance());
 }