Commit 544f3df
Separate engine initialization from startup (#1808)
* feat(engine): split Engine.start() into init() + start() with beforeStart hook
Introduce Engine.init() to start workers and boss without attaching
bindings; it is idempotent. Engine.start() now calls init() implicitly
before reading config and attaching bindings, so existing callers (CLI
start command, embedded users) are unaffected.
EngineRule gains a beforeStart(Runnable) builder (default no-op). The rule
now calls engine.init(), then runs the beforeStart hook and engine.start()
on a separate thread, allowing tests to block binding startup against an
external initialization signal (e.g. k3po awaitPrepared) before bindings
attach.
Closes #1807
https://claude.ai/code/session_01XcNeWBUJAA87NSf9R4KdVT
* refactor(engine): only spawn EngineRule start thread when beforeStart is set
Keep beforeStart null by default and branch on it: when no hook is set,
EngineRule starts the engine synchronously on the test thread exactly as
before, with no background thread. The init() + background start() path is
used only when a beforeStart hook is provided, preserving existing behavior
precisely for the common case.
https://claude.ai/code/session_01XcNeWBUJAA87NSf9R4KdVT
* refactor(engine): drop redundant beforeStart null assignment in EngineRule
Address review feedback: remove the explicit null initialization since
null is the implicit default for the reference field.
https://claude.ai/code/session_01XcNeWBUJAA87NSf9R4KdVT
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7527c66 commit 544f3df
3 files changed
Lines changed: 115 additions & 5 deletions
File tree
- runtime/engine/src
- main/java/io/aklivity/zilla/runtime/engine
- test/java/io/aklivity/zilla/runtime/engine
- internal
- test
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| 275 | + | |
274 | 276 | | |
275 | 277 | | |
276 | 278 | | |
| |||
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | | - | |
| 295 | + | |
294 | 296 | | |
295 | | - | |
| 297 | + | |
296 | 298 | | |
297 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
298 | 305 | | |
| 306 | + | |
299 | 307 | | |
300 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
301 | 312 | | |
302 | 313 | | |
303 | 314 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
77 | 124 | | |
78 | 125 | | |
79 | 126 | | |
| |||
Lines changed: 53 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
183 | 191 | | |
184 | 192 | | |
185 | 193 | | |
| |||
391 | 399 | | |
392 | 400 | | |
393 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
394 | 435 | | |
395 | 436 | | |
396 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
397 | 445 | | |
398 | 446 | | |
399 | 447 | | |
| |||
405 | 453 | | |
406 | 454 | | |
407 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
408 | 460 | | |
409 | 461 | | |
410 | 462 | | |
| |||
0 commit comments