Class LdapConfiguration.ContextConfiguration.PoolConfiguration
java.lang.Object
io.micronaut.security.ldap.configuration.LdapConfiguration.ContextConfiguration.PoolConfiguration
- Enclosing class:
LdapConfiguration.ContextConfiguration
@ConfigurationProperties("pool")
public static class LdapConfiguration.ContextConfiguration.PoolConfiguration
extends Object
Bounds of the JNDI LDAP connection pool, applied when
LdapConfiguration.ContextConfiguration.isPooled() is
true. The pool is shared by the whole JVM: the values are applied as the
com.sun.jndi.ldap.connect.pool.maxsize, com.sun.jndi.ldap.connect.pool.prefsize and
com.sun.jndi.ldap.connect.pool.timeout system properties when the configuration is created.
A value set here always wins. A value not set here keeps the system property if it is already set,
for example on the command line, and otherwise falls back to the default. getConnectTimeout()
is applied to the pooled manager context itself, as the com.sun.jndi.ldap.connect.timeout
JNDI environment property, and bounds the wait for a connection when the pool is saturated.
The JDK reads these system properties once, when the first pooled JNDI LDAP connection of the JVM is opened. Values applied after that have no effect.
- Since:
- 5.5.2
- Author:
- James Kleeh
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationThe default time a login waits for a pooled connection when the pool is saturated.static final DurationThe default time after which an idle pooled connection is closed.static final intThe default maximum number of pooled connections per connection identity.static final intThe default preferred number of pooled connections per connection identity.static final StringThe configuration prefix. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Duration@Nullable Duration@Nullable Integer@Nullable IntegervoidsetConnectTimeout(@Nullable Duration connectTimeout) Sets the time a login waits for a pooled connection to be released when the pool already holdsmax-sizeconnections, and the time allowed to open a new pooled connection.voidsetIdleTimeout(@Nullable Duration idleTimeout) Sets the time after which an idle pooled connection is closed.voidsetMaxSize(@Nullable Integer maxSize) Sets the maximum number of connections the pool keeps per connection identity (server, manager DN and password).voidsetPrefSize(@Nullable Integer prefSize) Sets the preferred number of connections the pool keeps per connection identity.
-
Field Details
-
PREFIX
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZEThe default maximum number of pooled connections per connection identity.- See Also:
-
DEFAULT_PREF_SIZE
public static final int DEFAULT_PREF_SIZEThe default preferred number of pooled connections per connection identity.- See Also:
-
DEFAULT_IDLE_TIMEOUT
The default time after which an idle pooled connection is closed. -
DEFAULT_CONNECT_TIMEOUT
The default time a login waits for a pooled connection when the pool is saturated.
-
-
Constructor Details
-
PoolConfiguration
public PoolConfiguration()
-
-
Method Details
-
getMaxSize
-
setMaxSize
Sets the maximum number of connections the pool keeps per connection identity (server, manager DN and password). Once reached, a login waits for a pooled connection to be released instead of opening a new one.0removes the bound, which lets a burst of login attempts exhaust the connections of the directory; a negative value is rejected. Default 20, unless thecom.sun.jndi.ldap.connect.pool.maxsizesystem property is already set.- Parameters:
maxSize- The maximum pool size
-
getPrefSize
-
setPrefSize
Sets the preferred number of connections the pool keeps per connection identity. Connections released above this number are closed rather than returned to the pool. A negative value is rejected. Default 5, unless thecom.sun.jndi.ldap.connect.pool.prefsizesystem property is already set.- Parameters:
prefSize- The preferred pool size
-
getIdleTimeout
- Returns:
- The time after which an idle pooled connection is closed, or null to keep the
com.sun.jndi.ldap.connect.pool.timeoutsystem property if set and otherwise use 5 minutes
-
setIdleTimeout
Sets the time after which an idle pooled connection is closed.0keeps idle connections open forever; a negative value is rejected. Default 5 minutes, unless thecom.sun.jndi.ldap.connect.pool.timeoutsystem property is already set.- Parameters:
idleTimeout- The idle timeout
-
getConnectTimeout
- Returns:
- The time a login waits for a pooled connection when the pool is saturated, or null for 10 seconds; always positive
-
setConnectTimeout
Sets the time a login waits for a pooled connection to be released when the pool already holdsmax-sizeconnections, and the time allowed to open a new pooled connection. Without it, the JDK waits indefinitely, so a hung directory operation holding every pooled connection would block every later login. Applied as thecom.sun.jndi.ldap.connect.timeoutJNDI environment property of the pooled manager context, unlessLdapConfiguration.ContextConfiguration.getProperties()already sets that key. The JDK waits indefinitely for a value of0or less, so such a value is rejected. Default 10 seconds.- Parameters:
connectTimeout- The connect timeout
-