cstamas commented on code in PR #299:
URL: https://github.com/apache/maven-resolver/pull/299#discussion_r1226661563


##########
maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/NamedLockSupport.java:
##########
@@ -32,18 +38,76 @@ public abstract class NamedLockSupport implements NamedLock 
{
 
     private final NamedLockFactorySupport factory;
 
+    private final ConcurrentHashMap<Thread, Deque<String>> state;
+
     public NamedLockSupport(final String name, final NamedLockFactorySupport 
factory) {
         this.name = name;
         this.factory = factory;
+        this.state = factory.diagnostic ? new ConcurrentHashMap<>() : null;
     }
 
     @Override
     public String name() {
         return name;
     }
 
+    @Override
+    public boolean lockShared(long time, TimeUnit unit) throws 
InterruptedException {
+        if (state != null) {
+            state.computeIfAbsent(Thread.currentThread(), k -> new 
ArrayDeque<>())
+                    .push("S");

Review Comment:
   Agreed, although named locks API does not limit (boxing depth), in reality 
syncContext does "shallow" boxing.



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