KafkaRequestHandler

KafkaRequestHandler is a thread of execution (java.lang.Runnable) that is responsible for relaying client requests (from a RequestChannel) to a KafkaApis (except ShutdownRequest requests that are handled directly).

KafkaRequestHandler is created exclusively when KafkaRequestHandlerPool is created (and starts the internal runnables threads).

KafkaRequestHandler start.png
Figure 1. KafkaRequestHandler’s Startup and Request Relay

KafkaRequestHandler uses [Kafka Request Handler [id] on Broker [brokerId]] as the logging prefix (aka logIdent).

Tip

Enable ALL logging levels for kafka.server.KafkaRequestHandler logger to see what happens inside.

Add the following line to config/log4j.properties:

log4j.logger.kafka.server.KafkaRequestHandler=ALL

Refer to Logging.

Creating KafkaRequestHandler Instance

KafkaRequestHandler takes the following to be created:

KafkaRequestHandler initializes the internal properties.

Starting KafkaRequestHandler Thread — run Method

run(): Unit
Note
run is part of the java.lang.Runnable to start itself as a separately-executing thread.

run runs continuously until KafkaRequestHandler is requested to stop (which turns the stopped internal flag on).

run…​FIXME

Stopping KafkaRequestHandler Thread — stop Method

stop(): Unit

stop simply turns the stopped internal flag on (true).

Note
stop is used exclusively when KafkaRequestHandlerPool is requested to resize the thread pool of KafkaRequestHandlers.

Internal Properties

Name Description

stopped

Flag to control whether run should stop (true) or not (false) (and hence the KafkaRequestHandler)

Default: false

Turned on (true) when KafkaRequestHandler is requested to stop

results matching ""

    No results matching ""