(Apologies in advance if this message doesn't thread correctly)

> Given that DefaultLegacySupport is already marked Singleton, could the
> static ThreadLocal be replaced with a final AtomicReference instance field?
> This would be accessible across all threads, has less chance of leaking and
> can still be updated in a thread-safe manner. Let me know if I should file
> a JIRA issue for this.

I've gone ahead and made this change in a fork:
https://github.com/apeteri/maven/commit/3d1679ddb448afdaa20b7add4845e428317d2232

The existing test case also demonstrates the issue - threads that run
long enough to "live through" a call to
DeafultLegacySupport#setSession are disallowed from using either the
old or the new MavenSession instance.

Do let me know if there are any gotchas that I'm missing and would
make this change problematic!

Regards,
András

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to