This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch file-lock in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
commit 2c38e1de5d267067ba5b1b51477013918752871a Author: Michael Osipov <[email protected]> AuthorDate: Sun Dec 12 20:50:55 2021 +0100 100-column boundary --- .../impl/synccontext/named/TakariNameMapper.java | 5 +++-- .../named/providers/FileLockNamedLockFactory.java | 4 ++-- .../aether/named/support/FileLockNamedLock.java | 15 ++++++++------- .../aether/named/support/FileSystemFriendly.java | 12 ++++++------ .../java/org/eclipse/aether/named/support/Retry.java | 19 ++++++++++--------- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java index cd3cc03..984a086 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/TakariNameMapper.java @@ -37,8 +37,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** - * A {@link NameMapper} that creates same name mapping as Takari Local Repository does, with baseDir (local repo). - * Part of code blatantly copies parts of the Takari {@code LockingSyncContext}. + * A {@link NameMapper} that creates same name mapping as Takari Local Repository does, with + * {@code baseDir} (local repo). Part of code blatantly copies parts of the Takari + * {@code LockingSyncContext}. * * @see <a href="https://github.com/takari/takari-local-repository/blob/24133e50a0478dccb5620ac2f2255187608f165b/src/main/java/io/takari/aether/concurrency/LockingSyncContext.java">Takari * LockingSyncContext.java</a> diff --git a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java index 7e9e89d..b40772e 100644 --- a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java +++ b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/providers/FileLockNamedLockFactory.java @@ -38,8 +38,8 @@ import org.eclipse.aether.named.support.NamedLockFactorySupport; import org.eclipse.aether.named.support.NamedLockSupport; /** - * Named locks factory of {@link FileLockNamedLock}s. This is a bit special implementation, as it expects locks names - * to be fully qualified absolute file system paths. + * Named locks factory of {@link FileLockNamedLock}s. This is a bit special implementation, as it + * expects locks names to be fully qualified absolute file system paths. * * @since TBD */ diff --git a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java index f519af2..b4c2877 100644 --- a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java +++ b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java @@ -35,14 +35,15 @@ import java.util.concurrent.locks.ReentrantLock; import static org.eclipse.aether.named.support.Retry.retry; /** - * Named lock that uses {@link FileLock}. An instance of this class is about ONE LOCK (one file) and is possibly used - * by multiple threads. Each thread (if properly coded re boxing) will try to obtain either shared or exclusive lock. - * As file locks are JVM-scoped (so one JVM can obtain same file lock only once), the threads share file lock and - * synchronize according to it. Still, as file lock obtain operation does not block (or in other words, the method - * that does block cannot be controlled for how long it blocks), we are "simulating" thread blocking using + * Named lock that uses {@link FileLock}. An instance of this class is about ONE LOCK (one file) + * and is possibly used by multiple threads. Each thread (if properly coded re boxing) will try to + * obtain either shared or exclusive lock. As file locks are JVM-scoped (so one JVM can obtain + * same file lock only once), the threads share file lock and synchronize according to it. Still, + * as file lock obtain operation does not block (or in other words, the method that does block + * cannot be controlled for how long it blocks), we are "simulating" thread blocking using * {@link Retry} utility. - * This implementation performs coordination not only on thread (JVM-local) level, but also on process level, - * as long as other parties are using this same "advisory" locking mechanism. + * This implementation performs coordination not only on thread (JVM-local) level, but also on + * process level, as long as other parties are using this same "advisory" locking mechanism. * * @since TBD */ diff --git a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileSystemFriendly.java b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileSystemFriendly.java index 9e66ff1..d029e4e 100644 --- a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileSystemFriendly.java +++ b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileSystemFriendly.java @@ -20,13 +20,13 @@ package org.eclipse.aether.named.support; */ /** - * A marker interface that mark component "file system friendly". In case of lock factory, it would mean that - * passed in lock names MUST ADHERE to file path naming convention (and not use some special, non FS friendly - * characters in it). Essentially, component marked with this interface expects (or uses) that "name" is an absolute - * and valid file path. + * A marker interface that mark component "file system friendly". In case of lock factory, it + * would mean that passed in lock names MUST ADHERE to file path naming convention (and not use + * some special, non FS friendly characters in it). Essentially, component marked with this + * interface expects (or uses) that "name" is an absolute and valid file path. * - * <strong>Important note:</strong> Experimental interface, is not meant to be used outside of Maven Resolver codebase. - * May change or be removed completely without any further notice. + * <strong>Important note:</strong> Experimental interface, is not meant to be used outside of + * Maven Resolver codebase. May change or be removed completely without any further notice. */ public interface FileSystemFriendly { diff --git a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/Retry.java b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/Retry.java index ad37b00..1f5a61b 100644 --- a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/Retry.java +++ b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/Retry.java @@ -27,11 +27,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Retry helper: retries given {@code Callable} as long it returns {@code null} (interpreted as "no answer yet") or - * given time passes. This helper implements similar semantics regarding caller thread as - * {@link java.util.concurrent.locks.Lock#tryLock(long, TimeUnit)} method does: blocks the caller thread until operation - * return non-{@code null} value within the given waiting time and the current thread has not been - * {@linkplain Thread#interrupt interrupted}. + * Retry helper: retries given {@code Callable} as long as it returns {@code null} (interpreted + * as "no answer yet") or given time passes. This helper implements similar semantics regarding + * caller threads as {@link java.util.concurrent.locks.Lock#tryLock(long, TimeUnit)} method does: + * blocks the caller thread until operation return non-{@code null} value within the given waiting + * time and the current thread has not been {@linkplain Thread#interrupt interrupted}. * * @since TBD */ @@ -45,10 +45,11 @@ public final class Retry } /** - * Retries for given amount of time (time, unit) the passed in operation, sleeping given sleepMills between - * retries. In case operation returns null, it is assumed "is not done yet" state, so retry will happen (if time - * barrier allows). If time barrier passes, and still {@code null} ("is not done yet") is returned from operation, - * the defaultResult is returned. + * Retries for given amount of time (time, unit) the passed in operation, sleeping given + * {@code sleepMills} between retries. In case operation returns {@code null}, it is assumed + * "is not done yet" state, so retry will happen (if time barrier allows). If time barrier + * passes, and still {@code null} ("is not done yet") is returned from operation, the + * {@code defaultResult} is returned. */ public static <R> R retry( final long time, final TimeUnit unit,
