Class DefaultNamedLockFactorySelector
- java.lang.Object
-
- org.eclipse.aether.internal.impl.named.DefaultNamedLockFactorySelector
-
- All Implemented Interfaces:
NamedLockFactorySelector
@Singleton @Named public class DefaultNamedLockFactorySelector extends java.lang.Object implements NamedLockFactorySelector
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONFIG_PROP_FACTORY_NAMEName of the lock factory to use in system.static java.lang.StringCONFIG_PROP_LOCK_WAIT_TIMEThe maximum amount of time to be blocked, while obtaining a named lock.static java.lang.StringCONFIG_PROP_LOCK_WAIT_TIME_UNITThe unit of maximum amount of time.static java.lang.StringCONFIG_PROPS_PREFIXstatic java.lang.StringDEFAULT_FACTORY_NAMEstatic longDEFAULT_LOCK_WAIT_TIMEstatic java.lang.StringDEFAULT_LOCK_WAIT_TIME_UNITprotected java.util.Map<java.lang.String,org.eclipse.aether.named.NamedLockFactory>factoriesprotected org.slf4j.Loggerloggerprotected java.util.concurrent.ConcurrentMap<java.lang.String,org.eclipse.aether.named.NamedLockFactory>usedFactories
-
Constructor Summary
Constructors Constructor Description DefaultNamedLockFactorySelector(java.util.Map<java.lang.String,org.eclipse.aether.named.NamedLockFactory> factories, RepositorySystemLifecycle lifecycle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>getAvailableLockFactories()Returns immutable set of available lock factory names, to be used for logging purposes or alike.longgetLockWaitTime(java.util.Map<java.lang.String,?> configuration)Returns the maximum amount of time to be blocked, while obtaining a named lock, based on configuration.java.util.concurrent.TimeUnitgetLockWaitTimeUnit(java.util.Map<java.lang.String,?> configuration)Returns the unit of maximum amount of time based on configuration.org.eclipse.aether.named.NamedLockFactorygetNamedLockFactory(java.util.Map<java.lang.String,?> configuration)SelectsNamedLockFactorybased on configuration.
-
-
-
Field Detail
-
CONFIG_PROPS_PREFIX
public static final java.lang.String CONFIG_PROPS_PREFIX
- See Also:
- Constant Field Values
-
CONFIG_PROP_FACTORY_NAME
public static final java.lang.String CONFIG_PROP_FACTORY_NAME
Name of the lock factory to use in system. Out of the box supported ones are "file-lock", "rwlock-local", "semaphore-local", "noop". By adding extensions one can extend available lock factories (for example IPC locking).- See Also:
- Constant Field Values
-
DEFAULT_FACTORY_NAME
public static final java.lang.String DEFAULT_FACTORY_NAME
- See Also:
- Constant Field Values
-
CONFIG_PROP_LOCK_WAIT_TIME
public static final java.lang.String CONFIG_PROP_LOCK_WAIT_TIME
The maximum amount of time to be blocked, while obtaining a named lock.- See Also:
- Constant Field Values
-
DEFAULT_LOCK_WAIT_TIME
public static final long DEFAULT_LOCK_WAIT_TIME
- See Also:
- Constant Field Values
-
CONFIG_PROP_LOCK_WAIT_TIME_UNIT
public static final java.lang.String CONFIG_PROP_LOCK_WAIT_TIME_UNIT
The unit of maximum amount of time. Accepts TimeUnit enum names.- See Also:
- Constant Field Values
-
DEFAULT_LOCK_WAIT_TIME_UNIT
public static final java.lang.String DEFAULT_LOCK_WAIT_TIME_UNIT
- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
-
factories
protected final java.util.Map<java.lang.String,org.eclipse.aether.named.NamedLockFactory> factories
-
usedFactories
protected final java.util.concurrent.ConcurrentMap<java.lang.String,org.eclipse.aether.named.NamedLockFactory> usedFactories
-
-
Constructor Detail
-
DefaultNamedLockFactorySelector
@Inject public DefaultNamedLockFactorySelector(java.util.Map<java.lang.String,org.eclipse.aether.named.NamedLockFactory> factories, RepositorySystemLifecycle lifecycle)
-
-
Method Detail
-
getAvailableLockFactories
public java.util.Set<java.lang.String> getAvailableLockFactories()
Description copied from interface:NamedLockFactorySelectorReturns immutable set of available lock factory names, to be used for logging purposes or alike. Never returnsnull.- Specified by:
getAvailableLockFactoriesin interfaceNamedLockFactorySelector
-
getNamedLockFactory
public org.eclipse.aether.named.NamedLockFactory getNamedLockFactory(java.util.Map<java.lang.String,?> configuration)
Description copied from interface:NamedLockFactorySelectorSelectsNamedLockFactorybased on configuration. Never returnsnullbut may throw in case of invalid configuration.- Specified by:
getNamedLockFactoryin interfaceNamedLockFactorySelector- Parameters:
configuration- The configuration maps, must be notnull.
-
getLockWaitTime
public long getLockWaitTime(java.util.Map<java.lang.String,?> configuration)
Description copied from interface:NamedLockFactorySelectorReturns the maximum amount of time to be blocked, while obtaining a named lock, based on configuration. May throw in case of invalid configuration.- Specified by:
getLockWaitTimein interfaceNamedLockFactorySelector- Parameters:
configuration- The configuration maps, must be notnull.
-
getLockWaitTimeUnit
public java.util.concurrent.TimeUnit getLockWaitTimeUnit(java.util.Map<java.lang.String,?> configuration)
Description copied from interface:NamedLockFactorySelectorReturns the unit of maximum amount of time based on configuration. Never returnsnullbut may throw in case of invalid configuration.- Specified by:
getLockWaitTimeUnitin interfaceNamedLockFactorySelector- Parameters:
configuration- The configuration maps, must be notnull.
-
-