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 2022/11/04 18:47:56 UTC

[GitHub] [maven-resolver] michael-o commented on a diff in pull request #216: [MRESOLVER-285] File locking tweaks for Windows OS

michael-o commented on code in PR #216:
URL: https://github.com/apache/maven-resolver/pull/216#discussion_r1014355905


##########
maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java:
##########
@@ -49,6 +52,33 @@
 {
     public static final String NAME = "file-lock";
 
+    /**
+     * Tweak: on Windows, the presence of {@link StandardOpenOption#DELETE_ON_CLOSE} causes concurrency issues. This
+     * flag allows to have it removed from effective flags, at the cost that lockfile directory becomes crowded
+     * with 0 byte sized lock files that are never cleaned up. Default value is {@code true}.
+     *
+     * @see <a href="https://bugs.openjdk.org/browse/JDK-8252883">JDK-8252883</a>
+     */
+    private static final boolean DELETE_LOCK_FILES = Boolean.parseBoolean(
+            System.getProperty( "aether.named.file-lock.deleteLockFiles", Boolean.TRUE.toString() ) );
+
+    /**
+     * Tweak: on Windows, the presence of {@link StandardOpenOption#DELETE_ON_CLOSE} causes concurrency issues. This
+     * flag allows to implement similar fix as referenced JDK bug report: retry and hope the best. Default value is
+     * 5 attempts (will retry 4 times).
+     *
+     * @see <a href="https://bugs.openjdk.org/browse/JDK-8252883">JDK-8252883</a>
+     */
+    private static final int ATTEMPTS = Integer.parseInt(
+            System.getProperty( "aether.named.file-lock.attempts", "5" ) );
+
+    /**
+     * Tweak: When {@link #ATTEMPTS} used, the amount of milliseconds to sleep between subsequent retries. Default
+     * value is 50 milliseconds.
+     */
+    private static final long SLEEP_MILLIS = Long.parseLong(
+            System.getProperty( "aether.named.file-lock.sleepMillis", "50" ) );
+

Review Comment:
   Now those are system properties and not session properties. Any reason?



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