ControllerEventThread¶
ControllerEventThread
is a ShutdownableThread
that ControllerEventManager uses to process QueuedEvents (asynchronously on a separate thread).
Review Me¶
ControllerEventThread
is a ShutdownableThread
that is <
// 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(java.base@12.0.2/Native Method)
- parking to wait for <0x00000007c07f0298> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(java.base@12.0.2/LockSupport.java:194)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@12.0.2/AbstractQueuedSynchronizer.java:2081)
at java.util.concurrent.LinkedBlockingQueue.take(java.base@12.0.2/LinkedBlockingQueue.java:433)
at kafka.controller.ControllerEventManager$ControllerEventThread.doWork(ControllerEventManager.scala:127)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:89)
ControllerEventThread
is <
[[creating-instance]][[name]] ControllerEventThread
takes the name of the thread to be created.
[[logIdent]] ControllerEventThread
uses [ControllerEventThread controllerId=[controllerId]] as the logging prefix (aka logIdent
).
=== [[doWork]] Processing Controller Events -- doWork
Method
[source, scala]¶
doWork(): Unit¶
doWork
takes (and removes) 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 link:kafka-controller-KafkaController.adoc#startup[started].
doWork
sets <ControllerEventManager
) to be the <
doWork
requests the <update
(with the time between the current time and the <
doWork
finds the KafkaTimer
for the current controller state (in <
In the end, doWork
sets the <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]