Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # dev >> Review Request 18740: Fix KAFKA-1286

Copy link to this message
Re: Review Request 18740: Fix KAFKA-1286

This is an automatically generated e-mail. To reply, visit:


    Can this be folded into the if statement below?


    Is this supposed to be here?


    I think this may be incorrect if the apikey enums are ever out of order or if we retire a key.
    Recommend instead the slightly more verbose:
    private static final ApiKey[] codeToType;
    static {
     int maxKey = -1;
     for(ApiKeys key: ApiKeys.values())
       maxKey = Math.max(maxKey, key.id);
     codeToType = new ApiKey[maxKey];
     for(ApiKey key: ApiKey.values())
       codeToType[key.id] = key;
- Jay Kreps
On March 4, 2014, 11:15 p.m., Guozhang Wang wrote: