[ 
https://issues.apache.org/jira/browse/HADOOP-1915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528452
 ] 

David Bowen commented on HADOOP-1915:
-------------------------------------

Couldn't you write a simple subclass of Enum with a static initialization 
method which reads the configuration and generates the Enum instances? It could 
also create a static hashmap so that the elements can be looked up by string.

I think that there would be a problem with the API you suggest, because the 
enum ordinal values would have to be generated on the fly, and we want them to 
be the same in different processes (as counters are transmitted between Java 
processes).





> adding counters methods using String (as opposed to Enum)
> ---------------------------------------------------------
>
>                 Key: HADOOP-1915
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1915
>             Project: Hadoop
>          Issue Type: New Feature
>         Environment: all
>            Reporter: Alejandro Abdelnur
>            Priority: Minor
>             Fix For: 0.15.0
>
>
> Currently to use the counters from within Map/Reduce code Enums have to be 
> used, the Enum class defines the group and the Enum itself the counter. 
> Internally they are converted to Strings (the class name and the enum 
> toString) and you can retrieve them as strings from the client API.
> Using dynamic counters (driven by configuration of the map/reduce) is not 
> easy with the counters Enum based API. For example, currently I have an Enum 
> class with 50 enums and we have to map the cardinality to the counter name on 
> the client. This is cumbersome.
> This could be easily improve by adding a String based counter method 
> increment(String group, String counter, long count) to allow use of the 
> counters without Enums.
> Internally this method already exists, so the changes are minimal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to