Class FileLockNamedLockFactory
- java.lang.Object
-
- org.eclipse.aether.named.support.NamedLockFactorySupport
-
- org.eclipse.aether.named.providers.FileLockNamedLockFactory
-
- All Implemented Interfaces:
NamedLockFactory
@Singleton @Named("file-lock") public class FileLockNamedLockFactory extends NamedLockFactorySupport
Named locks factory ofFileLockNamedLock
s. This is a bit special implementation, as it expects locks names to be fully qualified absolute file system paths.- Since:
- 1.7.3
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ATTEMPTS
Tweak: on Windows, the presence ofStandardOpenOption.DELETE_ON_CLOSE
causes concurrency issues.private static boolean
DELETE_LOCK_FILES
Tweak: on Windows, the presence ofStandardOpenOption.DELETE_ON_CLOSE
causes concurrency issues.private java.util.concurrent.ConcurrentMap<java.lang.String,java.nio.channels.FileChannel>
fileChannels
static java.lang.String
NAME
private static long
SLEEP_MILLIS
Tweak: WhenATTEMPTS
used, the amount of milliseconds to sleep between subsequent retries.-
Fields inherited from class org.eclipse.aether.named.support.NamedLockFactorySupport
logger
-
-
Constructor Summary
Constructors Constructor Description FileLockNamedLockFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NamedLockSupport
createLock(java.lang.String name)
Implementations shall create and returnNamedLockSupport
for givenname
, this method must never returnnull
.protected void
destroyLock(java.lang.String name)
Implementation may override this (empty) method to perform some sort of implementation specific cleanup for given lock name.-
Methods inherited from class org.eclipse.aether.named.support.NamedLockFactorySupport
closeLock, getLock, isDiagnosticEnabled, onFailure, shutdown
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
DELETE_LOCK_FILES
private static final boolean DELETE_LOCK_FILES
Tweak: on Windows, the presence ofStandardOpenOption.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 istrue
.- See Also:
- JDK-8252883
-
ATTEMPTS
private static final int ATTEMPTS
Tweak: on Windows, the presence ofStandardOpenOption.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 Also:
- JDK-8252883
-
SLEEP_MILLIS
private static final long SLEEP_MILLIS
Tweak: WhenATTEMPTS
used, the amount of milliseconds to sleep between subsequent retries. Default value is 50 milliseconds.
-
fileChannels
private final java.util.concurrent.ConcurrentMap<java.lang.String,java.nio.channels.FileChannel> fileChannels
-
-
Method Detail
-
createLock
protected NamedLockSupport createLock(java.lang.String name)
Description copied from class:NamedLockFactorySupport
Implementations shall create and returnNamedLockSupport
for givenname
, this method must never returnnull
.- Specified by:
createLock
in classNamedLockFactorySupport
-
destroyLock
protected void destroyLock(java.lang.String name)
Description copied from class:NamedLockFactorySupport
Implementation may override this (empty) method to perform some sort of implementation specific cleanup for given lock name. Invoked when reference count for given name drops to zero and named lock was removed.- Overrides:
destroyLock
in classNamedLockFactorySupport
-
-