You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/11/16 09:00:33 UTC

[GitHub] [maven-resolver] michael-o commented on a change in pull request #131: [MRESOLVER-219] File advisory locking based NamedLocks

michael-o commented on a change in pull request #131:
URL: https://github.com/apache/maven-resolver/pull/131#discussion_r750050573



##########
File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/NamedLockFactorySelector.java
##########
@@ -19,22 +19,33 @@
  * under the License.
  */
 
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.named.NamedLock;
 import org.eclipse.aether.named.NamedLockFactory;
 
+import java.util.concurrent.TimeUnit;
+
 /**
- * A {@link NamedLockFactory} that wants to make use of {@link RepositorySystemSession}.
+ * Selector for {@link NamedLockFactory} and {@link NameMapper} that selects and exposes selected ones. Essentially
+ * all the named locks configuration is here. Implementations may use different strategies to perform selection.
  */
-public interface SessionAwareNamedLockFactory extends NamedLockFactory
+public interface NamedLockFactorySelector
 {
     /**
-     * Creates or reuses existing {@link NamedLock}. Returns instance MUST BE treated as "resource", best in
-     * try-with-resource block.
-     *
-     * @param session the repository system session, must not be {@code null}
-     * @param name    the lock name, must not be {@code null}
-     * @return named  the lock instance, never {@code null}
+     * Returns the value of wait time, how much a lock blocks, must be greater than 0.
+     */
+    long waitTime();
+
+    /**
+     * Returns the time unit of {@link #waitTime()} value, never null.
+     */
+    TimeUnit waitTimeUnit();
+

Review comment:
       I don't now much we can change the API because we have released it already with 1.7.0. Maybe in 2.0.0, but consider that most locks don't use `Duration`, so a conversion is always necessary.




-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org