[ https://issues.apache.org/jira/browse/KAFKA-6024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16375921#comment-16375921 ]
ASF GitHub Bot commented on KAFKA-6024: --------------------------------------- shivsantham opened a new pull request #4617: KAFKA-6024 Move validation in KafkaConsumer ahead of acquireAndEnsure… URL: https://github.com/apache/kafka/pull/4617 In several methods, parameter validation is done after calling acquireAndEnsureOpen() in Kafka Consumer : public void seek(TopicPartition partition, long offset) { acquireAndEnsureOpen(); try { if (offset < 0) throw new IllegalArgumentException("seek offset must not be a negative number"); Since the value of parameter would not change per invocation, it seems performing validation ahead of acquireAndEnsureOpen() call would be better. Lost access to branch in the following PR. Basically incorporating the feedback from this. https://github.com/apache/kafka/pull/4109 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Consider moving validation in KafkaConsumer ahead of call to > acquireAndEnsureOpen() > ----------------------------------------------------------------------------------- > > Key: KAFKA-6024 > URL: https://issues.apache.org/jira/browse/KAFKA-6024 > Project: Kafka > Issue Type: Improvement > Reporter: Ted Yu > Assignee: siva santhalingam > Priority: Minor > > In several methods, parameter validation is done after calling > acquireAndEnsureOpen() : > {code} > public void seek(TopicPartition partition, long offset) { > acquireAndEnsureOpen(); > try { > if (offset < 0) > throw new IllegalArgumentException("seek offset must not be a > negative number"); > {code} > Since the value of parameter would not change per invocation, it seems > performing validation ahead of acquireAndEnsureOpen() call would be better. -- This message was sent by Atlassian JIRA (v7.6.3#76005)