Package org.ldaptive

Class LdapURLActivatorService


  • public final class LdapURLActivatorService
    extends Object
    Singleton which manages a single thread that periodically tests inactive LDAP URLs.
    • Field Detail

      • ACTIVATOR_PERIOD_PROPERTY

        private static final String ACTIVATOR_PERIOD_PROPERTY
        Ldap activator period system property.
        See Also:
        Constant Field Values
      • STALE_PERIOD_PROPERTY

        private static final String STALE_PERIOD_PROPERTY
        Ldap activator stale period system property.
        See Also:
        Constant Field Values
      • ACTIVATOR_PERIOD

        private static final Duration ACTIVATOR_PERIOD
        How often to test inactive connections. Default is 5 minutes.
      • STALE_PERIOD

        private static final Duration STALE_PERIOD
        Length of time to consider inactive connections stale. Default is 4 hours.
      • inactiveUrls

        private final List<LdapURL> inactiveUrls
        List of inactive URLs to test.
    • Constructor Detail

      • LdapURLActivatorService

        private LdapURLActivatorService()
        Default constructor.
    • Method Detail

      • getInstance

        public static LdapURLActivatorService getInstance()
        Returns the instance of this singleton.
        Returns:
        LDAP URL activator service
      • getPeriod

        public static Duration getPeriod()
        Returns the activator period.
        Returns:
        activator period
      • registerUrl

        public void registerUrl​(LdapURL url)
        Registers an LDAP URL to be tested for activation. Once a URL becomes active it is automatically removed.
        Parameters:
        url - that is inactive and should be tested to become active
      • getInactiveUrls

        public List<LdapURL> getInactiveUrls()
        Returns the list of inactive urls.
        Returns:
        inactive urls
      • testInactiveUrls

        void testInactiveUrls()
        Tests each registered URL. Removes URLs that successfully activated.
      • activateIfStale

        private void activateIfStale​(LdapURL url)
        Inspects the supplied url to determine how long it has been awaiting activation. For urls that have been attempting activation for a long period, activate them to potentially free the memory. URLs will return to this service if they are still in use and failing. See STALE_PERIOD
        Parameters:
        url - to inspect
      • clear

        void clear()
        Removes all registered inactive URLs.