Skip to content

WIP - delay locals capture from Vertx to contexts#5983

Draft
jponge wants to merge 1 commit intoeclipse-vertx:masterfrom
jponge:feat/delay-locals-capture
Draft

WIP - delay locals capture from Vertx to contexts#5983
jponge wants to merge 1 commit intoeclipse-vertx:masterfrom
jponge:feat/delay-locals-capture

Conversation

@jponge
Copy link
Member

@jponge jponge commented Feb 18, 2026

I am wondering if we'd benefit from shifting the context local captures from the Vertx instance to the actual contexts creation. This involves a few allocations on duplication, but I don't think it'd be that much of a problem.

One possible improvement (but I have not verified) is that it could allow new ContextLocal instances to be registered after a Vertx context has been initialized.

WDYT?

@vietj
Copy link
Member

vietj commented Feb 19, 2026

what is the goal ?

@jponge
Copy link
Member Author

jponge commented Feb 19, 2026

One possible improvement (but I have not verified) is that it could allow new ContextLocal instances to be registered after a Vertx context has been initialized.

@jponge
Copy link
Member Author

jponge commented Feb 19, 2026

It's not necessarily meant to be merged, I'm really wondering if we need to set in stone the locals array this early in the lifetime. I've had a test in the IDE + debugger where running would fail because the ContextLocal arrived later so the array index was wrong.

@vietj
Copy link
Member

vietj commented Feb 19, 2026

the main reason the context local list is captured when creating a vertx instance, is that context are created assuming the list does not change and therefore there is an exact mapping of ContextBase#locals and VertxImpl#contextLocals.

If contextLocals changes, then a context created before the list is updated will have an incorrect local storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments