rzo1 opened a new pull request, #2940:
URL: https://github.com/apache/tomee/pull/2940
## TOMEE-4703 / TOMEE-4704 — capture thread context on the submitting thread
Follow-up to #2939, which fixes the CME itself and should still go in for
10.x. This targets `main`
and addresses why the race exists.
`ApplicationThreadContextProvider.currentContext()` runs on the submitting
thread but stores a live
reference to its `ThreadContext`, and copies it later in `begin()`, on the
thread running the task.
The SPI asks for the opposite: `currentContext` "Captures from the current
thread a snapshot",
returning an "immutable snapshot ... captured from the current thread" that
"can be applied to any
number of threads, including concurrently".
### Commits
1. `340376ed25` — `endContext()` restored the class loader before
`ThreadContext.exit()`, which then
overwrote it, leaving pool threads on the application class loader.
Pre-existing, standalone,
backport candidate for 10.3.0.
2. `c940d73042` — capture eagerly into an immutable `ThreadContext.Capture`;
build a new
`ThreadContext` from it per `begin()`. Excludes `InvocationContext` and
`DestroyContext`, which are
tied to the submitter's invocation.
3. `c6cb5080c9` — `currentContextExecutor()` captured in `execute()` instead
of at creation, and one
`CUTask.Context` per task broke concurrent use of a contextual proxy.
4. `9d79f7de06` — TOMEE-4704: `CUTask.invoke()` did its setup outside the
`try`, so a failure there
skipped the listener callbacks and the cleanup.
TCK run:
https://ci-builds.apache.org/job/TomEe/job/pull-request-manual-with-tck/59/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]