Package org.ldaptive
Class LdapURLActivatorService
- java.lang.Object
-
- org.ldaptive.LdapURLActivatorService
-
public final class LdapURLActivatorService extends Object
Singleton which manages a single thread that periodically tests inactive LDAP URLs.
-
-
Field Summary
Fields Modifier and Type Field Description private static Duration
ACTIVATOR_PERIOD
How often to test inactive connections.private static String
ACTIVATOR_PERIOD_PROPERTY
Ldap activator period system property.private ScheduledThreadPoolExecutor
executor
Executor for testing inactive URLs.private List<LdapURL>
inactiveUrls
List of inactive URLs to test.private static LdapURLActivatorService
INSTANCE
Instance of this singleton.
-
Constructor Summary
Constructors Modifier Constructor Description private
LdapURLActivatorService()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
clear()
Removes all registered inactive URLs.List<LdapURL>
getInactiveUrls()
Returns the list of inactive urls.static LdapURLActivatorService
getInstance()
Returns the instance of this singleton.static Duration
getPeriod()
Returns the activator period.void
registerUrl(LdapURL url)
Registers an LDAP URL to be tested for activation.(package private) void
testInactiveUrls()
Tests each registered URL.
-
-
-
Field Detail
-
ACTIVATOR_PERIOD_PROPERTY
private static final String ACTIVATOR_PERIOD_PROPERTY
Ldap activator period system property.- See Also:
- Constant Field Values
-
ACTIVATOR_PERIOD
private static final Duration ACTIVATOR_PERIOD
How often to test inactive connections.
-
INSTANCE
private static final LdapURLActivatorService INSTANCE
Instance of this singleton.
-
executor
private final ScheduledThreadPoolExecutor executor
Executor for testing inactive URLs.
-
-
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.
-
clear
void clear()
Removes all registered inactive URLs.
-
-