style95 commented on a change in pull request #4459: Close the consumer when 
WakeupExcpetion happened
URL: 
https://github.com/apache/incubator-openwhisk/pull/4459#discussion_r287239410
 
 

 ##########
 File path: 
common/scala/src/main/scala/org/apache/openwhisk/connector/kafka/KafkaConsumerConnector.scala
 ##########
 @@ -132,6 +132,11 @@ class KafkaConsumerConnector(
         } else {
           throw e
         }
+      case e: WakeupException =>
+        logging.info(this, s"WakeupException happened when do commit action 
for topic ${topic}")
+        close()
+        recreateConsumer()
 
 Review comment:
   @dubee 
   Since we open neither `consumer` field nor `wakeup()` method, and currently 
`wakeup()` method is only called by `wakeupTask` scheduler, I think there would 
be no case that `WakeupException` thrown by `wakeupTask` is caught here.
   
   In the future, if we expose `wakeup()` method, while `commit()` is called, 
`wakeup()` method can be called in a different thread, then this change would 
help to handle it.
   Since all accesses to `consumer` are synchronized by `synchronized` keyword, 
it would be guaranteed that `wakeup()` would "wake up" only one thread at a 
time.
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to