@SuppressWarnings("unchecked") public void run() { MRRecord<K, V> record; while (true) { record = (MRRecord<K, V>) readArbitraryChannel(); if (record == null) { break; } K key = record.getKey(); V value = map(key); if (combiner == null) { record.setValue(value); String destination = getDestination(key); writeChannel(record, destination); } else { combiner.addTuple(key, value); } } flushMap(); shutdown(); }
public int compare(MRRecord<X, Y> first, MRRecord<X, Y> second) { return first.getValue().compareTo(second.getValue()); }