ControllerEventManager
ControllerEventManager
manages the event queue (of QueuedEvents) and the controller-event-thread for event processing.
ControllerEventManager
allows for emitting ControllerEvents (with optional preempting the queue first).
ControllerEventManager
is created exclusively for the KafkaController (when started up).
When started, ControllerEventManager
simply requests the ControllerEventThread to start processing ControllerEvents.
ControllerEventManager
is started when KafkaController
is started up.
ControllerEventManager
is in one of the possible ControllerStates.
Note
|
The state of ControllerEventManager is exactly the state of the owning KafkaController.
|
Creating ControllerEventManager Instance
ControllerEventManager
takes the following to be created:
-
Controller ID (i.e. the broker.id of the broker)
-
KafkaTimers
per ControllerState (Map[ControllerState, KafkaTimer]
)
ControllerEventManager
initializes the internal properties.
Performance Metrics
ControllerEventManager
is a KafkaMetricsGroup with the following performance metrics.
Metric Name | Description |
---|---|
|
|
|
Number of QueuedEvents in the event queue |
The performance metrics are registered in kafka.controller:type=ControllerEventManager group.
Emitting (Enqueuing) Controller Event — put
Method
put(event: ControllerEvent): QueuedEvent
put
creates a new QueuedEvent with the ControllerEvent and adds it at the end of the event queue.
Note
|
|
Starting ControllerEventManager (and ControllerEventThread) — start
Method
start(): Unit
start
simply requests the ControllerEventThread to start processing ControllerEvents.
Note
|
ControllerEventThread is a ShutdownableThread that triggers doWork() method when started.
|
Closing Up — close
Method
close(): Unit
close
simply clears the event queue and emits a ShutdownEventThread
event.
In the end, close
waits until the shutdown is complete. You should see the following INFO message in the logs:
Shutdown completed
Note
|
close is used exclusively when KafkaController is requested to shutdown.
|
Internal Properties
Name | Description |
---|---|
|
Event queue of QueuedEvents ( |
|
|
|
ControllerEventThread with controller-event-thread thread name |