You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by András Péteri <ap...@b2international.com> on 2021/04/09 11:43:29 UTC

Re: DefaultLegacySupport and long-lived worker threads

(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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org