Example #1
0
  @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();
  }
Example #2
0
 public int compare(MRRecord<X, Y> first, MRRecord<X, Y> second) {
   return first.getValue().compareTo(second.getValue());
 }