mapreduce自定义计数器

1.枚举

声明:enum Counter
{
LINESKIP;
}

    使用:context.getCounter(Counter.LINESKIP).increment(1);

2.动态声明

声明:final Counter count=context.getCounter(String groupName,String counterName)  

举例:final Counter count=context.getCounter(“敏感词汇”,“党”)  ;

使用:if(lines.toString.contains("党"))

        count.increment(1);

posted @ 2015-05-05 15:46  孟想阳光  阅读(427)  评论(0)    收藏  举报