Package org.ldaptive
Class LdapURLActivatorService
java.lang.Object
org.ldaptive.LdapURLActivatorService
Singleton which manages a single thread that periodically tests inactive LDAP URLs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DurationHow often to test inactive connections.private static final StringLdap activator period system property.List of inactive URLs to test.private static final LdapURLActivatorServiceInstance of this singleton.private static final DurationLength of time to consider inactive connections stale.private static final StringLdap activator stale period system property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidactivateIfStale(LdapURL url) Inspects the supplied url to determine how long it has been awaiting activation.(package private) voidclear()Removes all registered inactive URLs.Returns the collection of inactive urls.static LdapURLActivatorServiceReturns the instance of this singleton.static DurationReturns the activator period.voidregisterUrl(LdapURL url) Registers an LDAP URL to be tested for activation.(package private) voidTests each registered URL.
-
Field Details
-
ACTIVATOR_PERIOD_PROPERTY
Ldap activator period system property.- See Also:
-
STALE_PERIOD_PROPERTY
Ldap activator stale period system property.- See Also:
-
ACTIVATOR_PERIOD
How often to test inactive connections. Default is 5 minutes. -
STALE_PERIOD
Length of time to consider inactive connections stale. Default is 4 hours. -
INSTANCE
Instance of this singleton. -
inactiveUrls
List of inactive URLs to test.
-
-
Constructor Details
-
LdapURLActivatorService
private LdapURLActivatorService()Default constructor.
-
-
Method Details
-
getInstance
Returns the instance of this singleton.- Returns:
- LDAP URL activator service
-
getPeriod
Returns the activator period.- Returns:
- activator period
-
registerUrl
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
Returns the collection of inactive urls.- Returns:
- inactive urls
-
testInactiveUrls
void testInactiveUrls()Tests each registered URL. Removes URLs that successfully activated. -
activateIfStale
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. SeeSTALE_PERIOD- Parameters:
url- to inspect
-
clear
void clear()Removes all registered inactive URLs.
-