I want to acces the myCounter.my value in reducer :
public static class Map extends Mapper
You to make it work for new API by accessing the counters via job object.
Configuration conf = context.getConfiguration();
Cluster cluster = new Cluster(conf);
Job currentJob = cluster.getJob(context.getJobID());
long val=currentJob.getCounters().findCounter(myCounter.my).getValue();
You can access as follows:
Map.myCounter.my // static fields you can access by it's class name.
You can access your counter value in reducer using the same code
Counter counter = context.getCounter( myCounter.my );
counter.getValue();
also see