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

ASF GitHub Bot commented on MRESOLVER-370:
------------------------------------------

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


##########
maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/NamedLockFactory.java:
##########
@@ -35,4 +37,18 @@ public interface NamedLockFactory {
      * Performs a clean shut down of the factory.
      */
     void shutdown();
+
+    /**
+     * Utility method to provide more (factory specific) description when a 
locking operation failed. Assumption is
+     * that provided list has at least one element (one failure) or more (in 
case of retries), must not be {@code null}
+     * to get meaningful exceptions. The returned exception will be new 
instance of {@link IllegalStateException} with
+     * passed in list added as suppressed exceptions. Still, the fact this 
method has be invoked, means there is a
+     * "abort failure" ahead, so factory may either decorate (add info about 
state) or even log some diagnostic
+     * about the state of the locks.
+     *
+     * @since TBD
+     * @return A new instance of {@link IllegalStateException} (decorated) and 
may have other side effects as well
+     * (dumping state), never {@code null}.
+     */
+    IllegalStateException failure(List<IllegalStateException> attempts);

Review Comment:
   If `NamedLockFactory` is a public SPI, maybe a `default` method would be 
more appropriate here ?





> Lock factory should dump lock states on failure
> -----------------------------------------------
>
>                 Key: MRESOLVER-370
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-370
>             Project: Maven Resolver
>          Issue Type: Improvement
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Priority: Major
>
> When adapter "gives up" (as it could not acquire required lock), the error 
> currently states "how many retries were against which lock". This gives 
> information only about failed lock, but lacks the "whole picture".
> Proposed change: in case of lock failure, factory should dump out all lock 
> states (may be huge on big builds), as that would allow simpler 
> identification of possible problems. All this could be sorted out at "high 
> level" (so no need to fiddle with file locks, hazelcast or redisson), but for 
> memory constraints it should NOT be enabled by default, this "diagnostic" 
> should be turned off by default, but possible by users to turn on if needed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to