final List<RecordWriter<Record>> writers = new ArrayList<RecordWriter<Record>>(numOutputs);
// create a writer for each output
for (int i = 0; i < numOutputs; i++) {
// create the OutputEmitter from output ship strategy
final ShipStrategyType strategy = config.getOutputShipStrategy(i);
final TypeComparatorFactory<?> compFact = config.getOutputComparator(i, cl);
final RecordOutputEmitter oe;
if (compFact == null) {
oe = new RecordOutputEmitter(strategy);
} else {
@SuppressWarnings("unchecked")
TypeComparator<Record> comparator = (TypeComparator<Record>) compFact.createComparator();
if (!comparator.supportsCompareAgainstReference()) {
throw new Exception("Incompatibe serializer-/comparator factories.");
}
final DataDistribution distribution = config.getOutputDataDistribution(i, cl);
oe = new RecordOutputEmitter(strategy, comparator, distribution);
}
if (task instanceof AbstractTask) {
writers.add(new RecordWriter<Record>((AbstractTask) task, oe));
} else if (task instanceof AbstractInputTask<?>) {
writers.add(new RecordWriter<Record>((AbstractInputTask<?>) task, oe));
}
}
if (eventualOutputs != null) {
eventualOutputs.addAll(writers);
}
@SuppressWarnings("unchecked")
final Collector<T> outColl = (Collector<T>) new RecordOutputCollector(writers);
return outColl;
}
else {
// generic case
final List<RecordWriter<SerializationDelegate<T>>> writers = new ArrayList<RecordWriter<SerializationDelegate<T>>>(numOutputs);
// create a writer for each output
for (int i = 0; i < numOutputs; i++)
{
// create the OutputEmitter from output ship strategy
final ShipStrategyType strategy = config.getOutputShipStrategy(i);
final TypeComparatorFactory<T> compFactory = config.getOutputComparator(i, cl);
final DataDistribution dataDist = config.getOutputDataDistribution(i, cl);
final ChannelSelector<SerializationDelegate<T>> oe;
if (compFactory == null) {