junrao commented on a change in pull request #11351: URL: https://github.com/apache/kafka/pull/11351#discussion_r714186270
########## File path: core/src/main/scala/kafka/utils/KafkaScheduler.scala ########## @@ -107,7 +107,10 @@ class KafkaScheduler(val threads: Int, debug("Scheduling task %s with initial delay %d ms and period %d ms." .format(name, TimeUnit.MILLISECONDS.convert(delay, unit), TimeUnit.MILLISECONDS.convert(period, unit))) this synchronized { - ensureRunning() + if (!isStarted) { + info("Kafka scheduler is not running at the time '%s' is scheduled.".format(name)) + return null Review comment: In UnifiedLog, we have code uses the returned future. ` val producerExpireCheck = scheduler.schedule(name = "PeriodicProducerExpirationCheck", fun = () => { ` With this change, perhaps we could return an Option and let the caller deal with it accordingly? -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org