[ 
https://issues.apache.org/jira/browse/MRESOLVER-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17339083#comment-17339083
 ] 

Guillaume Nodet commented on MRESOLVER-179:
-------------------------------------------

I tend to think the new API is too fine grained.  In addition to the above 
problem, in my use case, having multiple calls to {{NamedLock}} would lead to 
multiple inter-process calls, while a single call could be sufficient.  I 
wonder if the NamedLock should be kept as an internal implementation detail of 
the {{SyncContextFactory}}.

> NamedLocks should be acquired in an ordered way
> -----------------------------------------------
>
>                 Key: MRESOLVER-179
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-179
>             Project: Maven Resolver
>          Issue Type: Bug
>            Reporter: Guillaume Nodet
>            Priority: Major
>
> [~michael-o] [~cstamas] I was about to start porting my simple SyncContext to 
> maven-resolver and start working on a PR when I saw that the API has changed 
> a lot with the introduction of NamedLocks.
> I see some design problems in the new API. Multiple locks are now acquired in 
> sequence instead of using a coarse grained call.  This can lead to deadlocks 
> as one client could try to lock {{a}} then {{b}} while another one could try 
> to lock {{b}} then {{a}}, leading to a possible deadlock. 
> It should be just a matter to order them inside the 
> {{AdaptedLockSyncContext.acquire}} call which is the only location where the 
> API is used.
> I'll provide a PR asap.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to