// jstack [brokerPid]
"controller-event-thread" #42 prio=5 os_prio=31 cpu=387,10ms elapsed=82679,68s tid=0x00007f920e489800 nid=0x14703 waiting on condition [0x000070000fcea000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x00000007c07f0298> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:194)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:2081)
at java.util.concurrent.LinkedBlockingQueue.take([email protected]/LinkedBlockingQueue.java:433)
at kafka.controller.ControllerEventManager$ControllerEventThread.doWork(ControllerEventManager.scala:127)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:89)
ControllerEventThread
ControllerEventThread
is a ShutdownableThread that is created for ControllerEventManager (with the name being controller-event-thread).
ControllerEventThread
is started with ControllerEventManager.
ControllerEventThread
uses [ControllerEventThread controllerId=[controllerId]] as the logging prefix (aka logIdent
).
Processing Controller Events — doWork
Method
doWork(): Unit
doWork
takes (and removes) a QueuedEvent from the head of the event queue (waiting for a QueuedEvent
to be available if the queue is empty).
Note
|
The very first event in the event queue is Startup that KafkaController puts when it is started.
|
doWork
requests the EventQueueTimeMs histogram to update
(with the time between the current time and the enqueue time of the event).
doWork
finds the KafkaTimer
for the current controller state (in rateAndTimeMetrics lookup table) to measure and record the time to requests the event to process using the ControllerEventProcessor.
In the end, doWork
sets the _state (of ControllerEventManager
) as Idle
.
In case of any error (Throwable
), doWork
simply prints out the following ERROR message to the logs:
Uncaught error processing event [controllerEvent]