gnodet commented on issue #12594:
URL: https://github.com/apache/maven/issues/12594#issuecomment-5457535929

   Closing as invalid after investigation.
   
   While `DefaultMaven` is indeed `@Singleton`, `LegacySupport` is already 
thread-safe via `ThreadLocal`:
   
   `DefaultLegacySupport` (at 
`impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java`)
 stores the session in a `private static final 
ThreadLocal<AtomicReference<MavenSession>> SESSION = new 
InheritableThreadLocal<>()`. Both `setSession()` and `getSession()` operate 
exclusively on this ThreadLocal, so each calling thread has its own isolated 
storage. No synchronization is needed.
   
   The `LegacySupport` interface's own Javadoc explicitly states the design 
intent: "Saving the session (in a thread-local variable) is our best effort to 
record any state."


-- 
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]

Reply via email to