ccding commented on a change in pull request #11351: URL: https://github.com/apache/kafka/pull/11351#discussion_r715088887
########## File path: core/src/main/scala/kafka/utils/KafkaScheduler.scala ########## @@ -141,9 +145,14 @@ class KafkaScheduler(val threads: Int, executor != null } } - - private def ensureRunning(): Unit = { - if (!isStarted) - throw new IllegalStateException("Kafka scheduler is not running.") - } +} + +private class NoOpScheduledFutureTask() extends ScheduledFuture[Unit] { + override def cancel(mayInterruptIfRunning: Boolean): Boolean = true + override def isCancelled: Boolean = true + override def isDone: Boolean = true + override def get(): Unit = {} + override def get(timeout: Long, unit: TimeUnit): Unit = {} + override def getDelay(unit: TimeUnit): Long = 0 + override def compareTo(o: Delayed): Int = 0 Review comment: NoOpScheduledFutureTask extends ScheduledFuture, ScheduledFuture extends Delayed, Delayed extends Comparable\<Delayed\>: therefore we should use Delayed here. Also, it doesn't compile if I changed it to ScheduledFuture Fixed the return value. -- 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