ControllerEventThread is a ShutdownableThread that is started when ControllerEventManager is started

ControllerEventThread doWork.png
Figure 1. ControllerEventThread is Started Alongside ControllerEventManager

When created, ControllerEventThread takes the name of the thread (which ControllerEventManager sets as controller-event-thread).

"controller-event-thread" #44 prio=5 os_prio=31 tid=0x00007fac45730800 nid=0xad03 waiting on condition [0x0000000178b30000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000007bcb03938> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.park(
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(
	at java.util.concurrent.LinkedBlockingQueue.take(
	at kafka.controller.ControllerEventManager$ControllerEventThread.doWork(ControllerEventManager.scala:48)

Processing Controller Events — doWork Method

doWork(): Unit

doWork takes and removes the head of event queue (waiting if necessary until an element becomes available).

The very first event in the event queue is Startup that KafkaController puts when it is started.

doWork sets _state (of ControllerEventManager) as the state of the event.

doWork finds the KafkaTimer for the state in rateAndTimeMetrics lookup table (of ControllerEventManager).

doWork processes the event (i.e. calls ControllerEvent.process method).

In the end, doWork passes the event to eventProcessedListener (of ControllerEventManager) and sets _state (of ControllerEventManager) as Idle.

results matching ""

    No results matching ""