jolshan commented on code in PR #14629:
URL: https://github.com/apache/kafka/pull/14629#discussion_r1382262985


##########
core/src/main/scala/kafka/server/KafkaRequestHandler.scala:
##########
@@ -50,28 +50,32 @@ object KafkaRequestHandler {
   }
 
   /**
-   * Wrap callback to schedule it on a request thread.
-   * NOTE: this function must be called on a request thread.
-   * @param fun Callback function to execute
-   * @return Wrapped callback that would execute `fun` on a request thread
+   * Execute or create a callback to be asynchronously scheduled on an 
arbitrary request thread
+   * NOTE: this function must be originally called from a request thread.
+   * @param asyncCompletionCallback A callback method that is expected to be 
executed once in an arbitrary request
+   *                                handler thread after an asynchronous 
action completes. The RequestLocal passed in
+   *                                must belong to the request handler thread 
that is executing the callback.
+   * @param requestLocal The RequestLocal for the current request handler 
thread in case we need to execute the callback
+   *                     function immediately without queueing the callback 
request
+   * @return Wrapped callback that schedules `asyncCompletionCallback` on an 
arbitrary request thread
    */
-  def wrap[T](fun: T => Unit): T => Unit = {
+  def executeOrRegisterAsyncCallback[T](asyncCompletionCallback: 
(RequestLocal, T) => Unit, requestLocal: RequestLocal): T => Unit = {

Review Comment:
   Yeah. I was thinking about that when I was renaming but I forgot that in the 
early return case, we still wrap. I'll change the description again to match 
this as well.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to