Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] Why does DefaultArtifactResolver.resolveArtifacts aquire an exclusive SyncContext in offline sessions?

Hi Igor,

> I haven't looked at the code recently, but what happens when two
> unrelated sessions resolve the same artifact? Even if one session is
> offline, the other maybe downloading the same artifact at the same time.

from what I understand, a shared SyncContext is a "read lock", an
exclusive SyncContext is a "write lock". I would imagine that the online
session downloading the artifact would have obtained an exclusive
SyncContext (whose implementation would then use, e.g., a FileLock under
the hood), which would prevent the offline session from obtaining its
shared SyncContext, blocking until the download is complete.

I am unsure, however, how SyncContexts are meant to used with multiple
sessions; the session's SyncContextFactories need to somehow produce
SyncContexts that can communicate, e.g., through FileLocks.

Anyway, the code calling SyncContext.acquire/close
(DefaultArtifactResolver.resolveArtifacts) needs to first state its
intention ("read access", "write access"). What a specific SyncContext
implementation makes of it is the second step.

Hope that clarifies things (or at least my understanding of said things ;-).

Andreas

-- 
Codetrails GmbH
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940


Back to the top