I am trying to use the new 0.8 counter access.
But my counter is always null:

protected static enum RecordCounters {
    PAGES_LOADED
};

...
    PigStatusReporter reporter = PigStatusReporter.getInstance();
    if (reporter != null) {
       recordCounter = reporter.getCounter(RecordCounters.PAGES_LOADED);
    }

recordCounter is null, and looking at the getCounter() code in
PigStatusReporter,
it is clear how that null value comes about: the reporter does not have
context. I see the
setContext()method, which takes a TaskInputOutputContext. I could presumably
call that method to fix the problem. But how do I get an instance of that
type of
context instance?

I also tried:
   recordCounter = reporter.getCounter("RecordCounters","PAGES_LOADED");

with the same result.

Thanks for any help,

Andreas

Reply via email to