merlimat commented on a change in pull request #3962: Feature / Interceptor for negative ack redelivery URL: https://github.com/apache/pulsar/pull/3962#discussion_r277072400
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerInterceptors.java ########## @@ -62,9 +63,9 @@ public ConsumerInterceptors(List<ConsumerInterceptor<T>> interceptors) { */ public Message<T> beforeConsume(Consumer<T> consumer, Message<T> message) { Message<T> interceptorMessage = message; - for (int i = 0; i < interceptors.size(); i++) { + for (ConsumerInterceptor<T> interceptor : interceptors) { Review comment: Yes, generally we should favor readability but these hooks are being called in the hot path for each messages produced/consumed. Also, in most cases people will not have interceptors configured, so the overhead should be (close to) 0. > what do you think of optimized index size for loop (prevents computing .size() for each iteration) ? : Sure, that looks good ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services