cstamas commented on code in PR #216: URL: https://github.com/apache/maven-resolver/pull/216#discussion_r1014407116
########## 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: Also, adapter (hence, factory) is created way before session. -- 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-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org