junrao commented on code in PR #13463:
URL: https://github.com/apache/kafka/pull/13463#discussion_r1154881426


##########
core/src/main/scala/kafka/common/InterBrokerSender.scala:
##########
@@ -156,6 +163,16 @@ abstract class InterBrokerSendThread(
   def wakeup(): Unit = networkClient.wakeup()
 }
 
+abstract class InterBrokerRequestManager() {
+  
+  var interBrokerSender: InterBrokerSender = _

Review Comment:
   Does this need to be volatile?



##########
core/src/main/scala/kafka/network/NetworkUtils.scala:
##########
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package kafka.network
+import kafka.server.KafkaConfig
+import org.apache.kafka.clients.{ApiVersions, ManualMetadataUpdater, 
NetworkClient}
+import org.apache.kafka.common.Reconfigurable
+import org.apache.kafka.common.metrics.Metrics
+import org.apache.kafka.common.network.{ChannelBuilders, NetworkReceive, 
Selectable, Selector}
+import org.apache.kafka.common.security.JaasContext
+import org.apache.kafka.common.utils.{LogContext, Time}
+
+import scala.jdk.CollectionConverters._
+
+object NetworkUtils {

Review Comment:
   Since we are gradually moving code from core to separate modules in java, 
could we move this to server-common and write it in java?



##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -59,8 +61,9 @@ object TransactionCoordinator {
       time, metrics)
 
     val logContext = new LogContext(s"[TransactionCoordinator 
id=${config.brokerId}] ")
-    val txnMarkerChannelManager = TransactionMarkerChannelManager(config, 
metrics, metadataCache, txnStateManager,
-      time, logContext)
+    val txnMarkerChannelManager = new TransactionMarkerChannelManager(config, 
metadataCache, txnStateManager,
+      time)
+    interBrokerSender.addRequestManager(txnMarkerChannelManager)

Review Comment:
   It's a bit inconvenient for very instance of InterBrokerRequestManager to do 
this. Would it be better to pass interBrokerSender to InterBrokerRequestManager 
and in the constructor do `interBrokerSender.addRequestManager(this)`?



##########
core/src/main/scala/kafka/common/InterBrokerSender.scala:
##########
@@ -45,10 +45,15 @@ abstract class InterBrokerSendThread(
 
   private val unsentRequests = new UnsentRequests
 
-  def generateRequests(): Iterable[RequestAndCompletionHandler]
+  private val requestManagers = new ArrayList[InterBrokerRequestManager]()

Review Comment:
   Do we need any synchronization for concurrency and visibility across threads?



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