Yunyung commented on code in PR #18450:
URL: https://github.com/apache/kafka/pull/18450#discussion_r1937409376


##########
core/src/main/scala/kafka/zookeeper/ZooKeeperClient.scala:
##########
@@ -59,63 +50,9 @@ class ZooKeeperClient(connectString: String,
                       time: Time,
                       metricGroup: String,
                       metricType: String,
-                      private[zookeeper] val clientConfig: ZKClientConfig,
                       name: String) extends Logging {
 
-  private val metricsGroup: KafkaMetricsGroup = new 
KafkaMetricsGroup(metricGroup, metricType)
-
   this.logIdent = s"[ZooKeeperClient $name] "
-  private val initializationLock = new ReentrantReadWriteLock()
-  private val isConnectedOrExpiredLock = new ReentrantLock()
-  private val isConnectedOrExpiredCondition = 
isConnectedOrExpiredLock.newCondition()
-  private val zNodeChangeHandlers = new ConcurrentHashMap[String, 
ZNodeChangeHandler]().asScala
-  private val zNodeChildChangeHandlers = new ConcurrentHashMap[String, 
ZNodeChildChangeHandler]().asScala
-  private val inFlightRequests = new Semaphore(maxInFlightRequests)
-  private val stateChangeHandlers = new ConcurrentHashMap[String, 
StateChangeHandler]().asScala
-  private[zookeeper] val reinitializeScheduler = new KafkaScheduler(1, true, 
s"zk-client-${threadPrefix}reinit-")
-  private var isFirstConnectionEstablished = false
-
-  private val metricNames = mutable.Set[String]()
-
-  // The state map has to be created before creating ZooKeeper since it's 
needed in the ZooKeeper callback.
-  private val stateToMeterMap = {
-    import KeeperState._
-    val stateToEventTypeMap = Map(
-      Disconnected -> "Disconnects",
-      SyncConnected -> "SyncConnects",
-      AuthFailed -> "AuthFailures",
-      ConnectedReadOnly -> "ReadOnlyConnects",
-      SaslAuthenticated -> "SaslAuthentications",
-      Expired -> "Expires"
-    )
-    stateToEventTypeMap.map { case (state, eventType) =>
-      val name = s"ZooKeeper${eventType}PerSec"
-      metricNames += name
-      state -> metricsGroup.newMeter(name, eventType.toLowerCase(Locale.ROOT), 
TimeUnit.SECONDS)
-    }
-  }
-
-  info(s"Initializing a new session to $connectString.")
-  // Fail-fast if there's an error during construction (so don't call 
initialize, which retries forever)
-  @volatile private var zooKeeper = new ZooKeeper(connectString, 
sessionTimeoutMs, ZooKeeperClientWatcher,
-    clientConfig)
-
-  metricsGroup.newGauge("SessionState", () => connectionState.toString)

Review Comment:
   Sure. Also thanks to @m1a2st for pointing this out.



-- 
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

Reply via email to