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 of
FileLockNamedLocks. 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
FieldsModifier and TypeFieldDescriptionprivate static final intTweak: on Windows, the presence ofStandardOpenOption.DELETE_ON_CLOSEcauses concurrency issues.private static final booleanTweak: on Windows, the presence ofStandardOpenOption.DELETE_ON_CLOSEcauses concurrency issues.private final ConcurrentMap<String, FileChannel> static final Stringprivate static final longTweak: WhenATTEMPTSused, the amount of milliseconds to sleep between subsequent retries.Fields inherited from class org.eclipse.aether.named.support.NamedLockFactorySupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected NamedLockSupportcreateLock(String name) Implementations shall create and returnNamedLockSupportfor givenname, this method must never returnnull.protected voiddestroyLock(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 Details
-
NAME
- See Also:
-
DELETE_LOCK_FILES
private static final boolean DELETE_LOCK_FILESTweak: on Windows, the presence ofStandardOpenOption.DELETE_ON_CLOSEcauses 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:
-
ATTEMPTS
private static final int ATTEMPTSTweak: on Windows, the presence ofStandardOpenOption.DELETE_ON_CLOSEcauses 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:
-
SLEEP_MILLIS
private static final long SLEEP_MILLISTweak: WhenATTEMPTSused, the amount of milliseconds to sleep between subsequent retries. Default value is 50 milliseconds. -
fileChannels
-
-
Constructor Details
-
FileLockNamedLockFactory
public FileLockNamedLockFactory()
-
-
Method Details
-
createLock
Description copied from class:NamedLockFactorySupportImplementations shall create and returnNamedLockSupportfor givenname, this method must never returnnull.- Specified by:
createLockin classNamedLockFactorySupport
-
destroyLock
Description copied from class:NamedLockFactorySupportImplementation 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:
destroyLockin classNamedLockFactorySupport
-