Class NamedLockFactoryAdapterFactoryImpl

  • All Implemented Interfaces:
    NamedLockFactoryAdapterFactory, Service

    @Singleton
    @Named
    public class NamedLockFactoryAdapterFactoryImpl
    extends java.lang.Object
    implements NamedLockFactoryAdapterFactory, Service
    Default implementation of NamedLockFactoryAdapterFactory. This implementation creates new instances of the adapter on every call. In turn, on shutdown, it will shut down all existing named lock factories. This is merely for simplicity, to not have to track "used" named lock factories, while it exposes all available named lock factories to callers.

    Most members and methods of this class are protected. It is meant to be extended in case of need to customize its behavior. An exception from this are private static methods, mostly meant to provide out of the box defaults and to be used when no Eclipse Sisu component container is used.

    Since:
    1.9.1
    • Field Detail

      • DEFAULT_FACTORY_NAME

        private static final java.lang.String DEFAULT_FACTORY_NAME
        See Also:
        Constant Field Values
      • DEFAULT_NAME_MAPPER_NAME

        private static final java.lang.String DEFAULT_NAME_MAPPER_NAME
        See Also:
        Constant Field Values
      • NAME_MAPPER_KEY

        protected static final java.lang.String NAME_MAPPER_KEY
        See Also:
        Constant Field Values
      • logger

        protected final org.slf4j.Logger logger
      • factories

        protected final java.util.Map<java.lang.String,​NamedLockFactory> factories
      • defaultFactoryName

        protected final java.lang.String defaultFactoryName
      • nameMappers

        protected final java.util.Map<java.lang.String,​NameMapper> nameMappers
      • defaultNameMapperName

        protected final java.lang.String defaultNameMapperName
    • Constructor Detail

      • NamedLockFactoryAdapterFactoryImpl

        @Deprecated
        public NamedLockFactoryAdapterFactoryImpl()
        Deprecated.
        for use in SL only.
        Default constructor for non Eclipse Sisu uses.
      • NamedLockFactoryAdapterFactoryImpl

        public NamedLockFactoryAdapterFactoryImpl​(java.util.Map<java.lang.String,​NamedLockFactory> factories,
                                                  java.lang.String defaultFactoryName,
                                                  java.util.Map<java.lang.String,​NameMapper> nameMappers,
                                                  java.lang.String defaultNameMapperName,
                                                  RepositorySystemLifecycle lifecycle)
    • Method Detail

      • getManuallyCreatedFactories

        private static java.util.Map<java.lang.String,​NamedLockFactory> getManuallyCreatedFactories()
      • getManuallyCreatedNameMappers

        private static java.util.Map<java.lang.String,​NameMapper> getManuallyCreatedNameMappers()
      • initService

        public void initService​(ServiceLocator locator)
        Description copied from interface: Service
        Provides the opportunity to initialize this service and to acquire other services for its operation from the locator. A service must not save the reference to the provided service locator.
        Specified by:
        initService in interface Service
        Parameters:
        locator - The service locator, must not be null.
      • getFactoryName

        protected java.lang.String getFactoryName​(RepositorySystemSession session)
        Returns the selected (user configured or default) named lock factory name, never null.
      • getDefaultFactoryName

        protected java.lang.String getDefaultFactoryName()
        Returns the default named lock factory name, never null.
      • getNameMapperName

        protected java.lang.String getNameMapperName​(RepositorySystemSession session)
        Returns the selected (user configured or default) name mapper name, never null.
      • getDefaultNameMapperName

        protected java.lang.String getDefaultNameMapperName()
        Returns the default name mapper name, never null.
      • selectFactory

        protected NamedLockFactory selectFactory​(java.lang.String factoryName)
        Selects a named lock factory, never returns null.
      • selectNameMapper

        protected NameMapper selectNameMapper​(java.lang.String nameMapperName)
        Selects a name mapper, never returns null.
      • shutdown

        protected void shutdown()
        To be invoked on repository system shut down. This method will shut down each NamedLockFactory.