MNG-7401 - Make MavenSession#getCurrentProject() using a thread local#666
MNG-7401 - Make MavenSession#getCurrentProject() using a thread local#666laeubi wants to merge 2 commits intoapache:masterfrom
Conversation
|
We previously has serious regressions with thread locals, I don't know whether this is a good idea. @gnodet |
I have found some places where the active data was not reset and that might be the cause for such issues. I think I'll update the PR to create a new thread local, than this would be backward compatible and one could change the code accordingly afterwards. |
|
+1 to fix instance lifecycle and not use any threadlocal which got proven brekaing plugins too much |
What do you mean here in particular? I think it is quite clear to me now what would be the issue with my inital approach thanks to @michael-o and I'm about to fix that. Passing the Session all along seems to break the idea of DI... |
This allows multiple threads to set/get the current project on the same session object while still having clones maintain there own state.
|
I have adjusted the PR let me know what you think. |
|
The only issue that can arise now is that I set the current project and pass the session to another thread without cloning it, but that should be illegal/broken already before isn't it? |
|
One workaround seems to use the |
|
Resolve #9168 |
This allows multiple threads to set/get the current project on the same session object while still having clones maintain there own state.
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MNG-XXX] SUMMARY, where you replaceMNG-XXXand
SUMMARYwith the appropriate JIRA issue. Best practice is to use the JIRA issuetitle in the pull request title and in the first line of the commit message.
mvn clean verifyto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.