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 NamedLockFactorySupportNamed locks factory ofFileLockNamedLocks. This is a bit of special implementation, as it expects locks names to be proper URI string representations (usefile:protocol for default file system).- Since:
- 1.7.3
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEstatic java.lang.StringSYSTEM_PROP_ATTEMPTSTweak: on Windows, the presence of StandardOpenOption#DELETE_ON_CLOSE causes concurrency issues.static java.lang.StringSYSTEM_PROP_DELETE_LOCK_FILESTweak: on Windows, the presence of StandardOpenOption#DELETE_ON_CLOSE causes concurrency issues.static java.lang.StringSYSTEM_PROP_SLEEP_MILLISTweak: WhenSYSTEM_PROP_ATTEMPTSused, the amount of milliseconds to sleep between subsequent retries.-
Fields inherited from class org.eclipse.aether.named.support.NamedLockFactorySupport
logger, SYSTEM_PROP_DIAGNOSTIC_ENABLED
-
-
Constructor Summary
Constructors Constructor Description FileLockNamedLockFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NamedLockSupportcreateLock(NamedLockKey key)Implementations shall create and returnNamedLockSupportfor givenname, this method must never returnnull.protected voiddestroyLock(NamedLock namedLock)Implementation may override this (empty) method to perform some sort of implementation specific cleanup for given lock name.protected voiddoShutdown()-
Methods inherited from class org.eclipse.aether.named.support.NamedLockFactorySupport
closeLock, doGetLock, getLock, getLockAndRefTrack, isDiagnosticEnabled, onFailure, shutdown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.aether.named.NamedLockFactory
getLock
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
SYSTEM_PROP_DELETE_LOCK_FILES
public static final java.lang.String SYSTEM_PROP_DELETE_LOCK_FILES
Tweak: on Windows, the presence of 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 istrueon non-Windows OS. See JDK-8252883 for Windows related bug. Users on Windows can still force "delete on close" by explicitly setting this property totrue.- See Also:
- JDK-8252883, Constant Field Values
-
SYSTEM_PROP_ATTEMPTS
public static final java.lang.String SYSTEM_PROP_ATTEMPTS
Tweak: on Windows, the presence of 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 Also:
- JDK-8252883, Constant Field Values
-
SYSTEM_PROP_SLEEP_MILLIS
public static final java.lang.String SYSTEM_PROP_SLEEP_MILLIS
Tweak: WhenSYSTEM_PROP_ATTEMPTSused, the amount of milliseconds to sleep between subsequent retries. Default value is 50 milliseconds.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileLockNamedLockFactory
public FileLockNamedLockFactory()
-
-
Method Detail
-
createLock
protected NamedLockSupport createLock(NamedLockKey key)
Description copied from class:NamedLockFactorySupportImplementations shall create and returnNamedLockSupportfor givenname, this method must never returnnull.- Specified by:
createLockin classNamedLockFactorySupport
-
destroyLock
protected void destroyLock(NamedLock namedLock)
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
-
doShutdown
protected void doShutdown()
- Overrides:
doShutdownin classNamedLockFactorySupport
-
-