You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Note:** Registering with a parent class like `TaskRunnerEvent.class` does **not** create a catch-all listener. The dispatcher routes by exact event class. The only "promiscuous" key is `ConductorClientEvent.class`, which receives all events regardless of type.
@@ -1142,15 +1148,16 @@ public class WorkerScaler implements TaskRunnerEventsListener {
1142
1148
1143
1149
### Async Event Publishing
1144
1150
1145
-
All events are published asynchronously using `CompletableFuture.runAsync()`, which ensures:
1151
+
All events are published asynchronously using `CompletableFuture.runAsync()` with a dedicated static single-thread daemon executor (`conductor-event-dispatch`), which ensures:
1146
1152
-**Non-blocking**: Task execution is never blocked by event processing
1147
1153
-**Independent failure**: If a listener throws an exception, it doesn't affect task execution
1148
-
-**Scalability**: Event processing can scale independently
1154
+
-**Serialized dispatch**: All events are processed in order on a single thread; listeners should remain lightweight to avoid becoming a bottleneck
1155
+
1156
+
For cases where async dispatch is unsafe (e.g. inside an `UncaughtExceptionHandler`), the `publishSync()` method dispatches directly on the calling thread.
1149
1157
1150
1158
### Thread Safety
1151
1159
1152
-
-**CopyOnWriteArrayList**: Used for listener storage, optimized for read-heavy workloads
1153
-
-**ConcurrentHashMap**: Used for event type to listener mappings
1160
+
-**ConcurrentHashMap**: Used for both event-type-to-listeners mapping and per-event-type listener storage (keyed by listener identity)
1154
1161
-**Immutable Events**: All event objects are immutable (final fields), preventing race conditions
0 commit comments