public void incrCounter(Enum<?> key, long incr) {
    PigStatusReporter reporter = PigStatusReporter.getInstance();
    if (reporter != null && reporter.getCounter(key) != null) {
      HadoopCompat.incrementCounter(reporter.getCounter(key), incr);
      if (counterEnumMap_.size() > 0) {
        for (Map.Entry<Enum<?>, Long> entry : counterEnumMap_.entrySet()) {
          HadoopCompat.incrementCounter(
              reporter.getCounter(entry.getKey()), entry.getValue());
        }
        counterEnumMap_.clear();
      }
    } else { // buffer the increments
      Long currentValue = counterEnumMap_.get(key);
      counterEnumMap_.put(key, (currentValue == null ? 0 : currentValue) + incr);
    }
  }
public void incrCounter(Enum<?> key, long incr) {
    PigStatusReporter reporter = PigStatusReporter.getInstance();
    if (reporter != null && reporter.getCounter(key) != null) {
      HadoopCompat.incrementCounter(reporter.getCounter(key), incr);
      if (counterEnumMap_.size() > 0) {
        for (Map.Entry<Enum<?>, Long> entry : counterEnumMap_.entrySet()) {
          HadoopCompat.incrementCounter(
              reporter.getCounter(entry.getKey()), entry.getValue());
        }
        counterEnumMap_.clear();
      }
    } else { 
      Long currentValue = counterEnumMap_.get(key);
      counterEnumMap_.put(key, (currentValue == null ? 0 : currentValue) + incr);
    }
  }
public void incrCounter ( Enum < ? > key , long incr ) { PigStatusReporter reporter = PigStatusReporter . getInstance ( ) ; if ( reporter != null && reporter . getCounter ( key ) != null ) { HadoopCompat . incrementCounter ( reporter . getCounter ( key ) , incr ) ; if ( counterEnumMap_ . size ( ) > 0 ) { for ( Map . Entry < Enum < ? > , Long > entry : counterEnumMap_ . entrySet ( ) ) { HadoopCompat . incrementCounter ( reporter . getCounter ( entry . getKey ( ) ) , entry . getValue ( ) ) ; } counterEnumMap_ . clear ( ) ; } } else { // buffer the increments Long currentValue = counterEnumMap_ . get ( key ) ; counterEnumMap_ . put ( key , ( currentValue == null ? 0 : currentValue ) + incr ) ; } }
Mocks the Reporter.incrCounter, but adds buffering.
See org.apache.hadoop.mapred.Reporter's incrCounter.
Mocks the Reporter . incrCounter but adds buffering . See org . apache . hadoop . mapred . Reporter s incrCounter .