You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/17 12:01:02 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #9764: MINOR: Allow extra params in KafkaScheduler#scheduleOnce and use it in ZooKeeperClient

chia7712 commented on a change in pull request #9764:
URL: https://github.com/apache/kafka/pull/9764#discussion_r545034745



##########
File path: core/src/main/scala/kafka/utils/KafkaScheduler.scala
##########
@@ -99,8 +99,8 @@ class KafkaScheduler(val threads: Int,
     }
   }
 
-  def scheduleOnce(name: String, fun: () => Unit): Unit = {
-    schedule(name, fun, delay = 0L, period = -1L, unit = TimeUnit.MILLISECONDS)
+  def scheduleOnce(name: String, fun: () => Unit, delay: Long = 0L, unit: TimeUnit = TimeUnit.MILLISECONDS): Unit = {

Review comment:
       It seems to me we should remove ```scheduleOnce``` as it is equal to parent ```schedule`` (with default value)
   
   see https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/utils/KafkaScheduler.scala#L56

##########
File path: core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala
##########
@@ -430,10 +430,10 @@ class ZooKeeperClient(connectString: String,
 
   // Visibility for testing
   private[zookeeper] def scheduleReinitialize(name: String, message: String, delayMs: Long): Unit = {
-    reinitializeScheduler.schedule(name, () => {
+    reinitializeScheduler.scheduleOnce(name, () => {

Review comment:
       How about calling ```schedule```? ```period``` and ```unit``` are equal to default 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org