gnodet commented on pull request #532:
URL: https://github.com/apache/maven/pull/532#issuecomment-916916826


   > Stupid question: Is this threadsafe?
   
   Yes, the access to the `SessionData` is completely safe.  The cache itself 
is a `ConcurrentHashMap`, so it should be fine too.  There's no atomicity 
guarantee, i.e. if two threads request the exact same version simultaneously, 
there's no guarantee that only a single remote request will be done, but the 
assumption is that those two requests should return the same result anyway.  If 
we imagine this is not the case, we fallback to the previous behavior (for the 
first 2 concurrent requests), i.e. 2 remote requests will be performed and the 
results will be returned.  Subsequent requests will return the cached result.
   So the data structures are thread safe (no exception will occur). The 
returned data is more stable than in the current behavior (i.e. two consecutive 
requests will return the same cached result).  The only ap is the one mentioned 
above, which I don't think we need to care about.


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