APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.jndi.ldap

public final Class LdapPoolManager

extends Object
Class Inheritance
Imports
java.io.PrintStream, .OutputStream, java.util.Hashtable, .Locale, .StringTokenizer, javax.naming.ldap.Control, javax.naming.NamingException, .CommunicationException, com.sun.jndi.ldap.pool.PoolCleaner, .Pool, jdk.internal.misc.InnocuousThread

Contains utilities for managing connection pools of LdapClient. Contains method for - checking whether attempted connection creation may be pooled - creating a pooled connection - closing idle connections. If a timeout period has been configured, then it will automatically close and remove idle connections (those that have not been used for the duration of the timeout period).
Author
Rosanna Lee

Field Summary

Modifier and TypeField and Description
private static final String
public static final boolean
private static final String
private static final int
private static final int
private static final int
private static final String
private static final int
private static final int
private static final long
private static final String
private static final int
private static final String
private static final int
private static final int
private static final String
private static final String
private static final String
private static final Pool[]
private static final String
private static final int
private static final String
private static final int
private static boolean
private static boolean
public static final boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
d(String msg)

private static void
d(String msg, String o)

public static void
expire(long
Close connections idle since this time, as specified in milliseconds since "the epoch".
threshold
)

Closes idle connections idle since specified time.

private static int
findPool(String
mechanism type
mech
)

Find the index of the pool for the specified mechanism.

pack-priv static LdapClient

Returns:

an LdapClient that is pooled.
getLdapClient
(String host, int port, String socketFactory, int connTimeout, int readTimeout, OutputStream trace, int version, String authMech, Control[] ctls, String protocol, String user, Object passwd, Hashtable<?, ?> env)

Obtains a pooled connection that either already exists or is newly created using the parameters supplied.

pack-priv static boolean
isPoolingAllowed(String socketFactory, OutputStream trace, String authMech, String protocol, Hashtable<?, ?> env)

Determines whether pooling is allowed given information on how the connection will be used.

public static void
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
private static final String DEBUG
debugback to summary
public static final boolean debug
DEFAULT_AUTH_MECHSback to summary
private static final String DEFAULT_AUTH_MECHS
DEFAULT_INIT_POOL_SIZEback to summary
private static final int DEFAULT_INIT_POOL_SIZE
DEFAULT_MAX_POOL_SIZEback to summary
private static final int DEFAULT_MAX_POOL_SIZE
DEFAULT_PREF_POOL_SIZEback to summary
private static final int DEFAULT_PREF_POOL_SIZE
DEFAULT_PROTOCOLSback to summary
private static final String DEFAULT_PROTOCOLS
DEFAULT_TIMEOUTback to summary
private static final int DEFAULT_TIMEOUT
DIGESTback to summary
private static final int DIGEST
idleTimeoutback to summary
private static final long idleTimeout
INIT_POOL_SIZEback to summary
private static final String INIT_POOL_SIZE
initSizeback to summary
private static final int initSize
MAX_POOL_SIZEback to summary
private static final String MAX_POOL_SIZE
maxSizeback to summary
private static final int maxSize
NONEback to summary
private static final int NONE
POOL_AUTHback to summary
private static final String POOL_AUTH
POOL_PROTOCOLback to summary
private static final String POOL_PROTOCOL
POOL_TIMEOUTback to summary
private static final String POOL_TIMEOUT
poolsback to summary
private static final Pool[] pools
PREF_POOL_SIZEback to summary
private static final String PREF_POOL_SIZE
prefSizeback to summary
private static final int prefSize
SASL_CALLBACKback to summary
private static final String SASL_CALLBACK
SIMPLEback to summary
private static final int SIMPLE
supportPlainProtocolback to summary
private static boolean supportPlainProtocol
supportSslProtocolback to summary
private static boolean supportSslProtocol
traceback to summary
public static final boolean trace

Constructor Detail

LdapPoolManagerback to summary
private LdapPoolManager()

Method Detail

dback to summary
private static void d(String msg)
dback to summary
private static void d(String msg, String o)
expireback to summary
public static void expire(long threshold)

Closes idle connections idle since specified time.

Parameters
threshold:long

Close connections idle since this time, as specified in milliseconds since "the epoch".

See Also
java.util.Date
findPoolback to summary
private static int findPool(String mech)

Find the index of the pool for the specified mechanism. If not one of "none", "simple", "DIGEST-MD5", or "GSSAPI", return -1.

Parameters
mech:String

mechanism type

getLdapClientback to summary
pack-priv static LdapClient getLdapClient(String host, int port, String socketFactory, int connTimeout, int readTimeout, OutputStream trace, int version, String authMech, Control[] ctls, String protocol, String user, Object passwd, Hashtable<?, ?> env) throws NamingException

Obtains a pooled connection that either already exists or is newly created using the parameters supplied. If it is newly created, it needs to go through the authentication checks to determine whether an LDAP bind is necessary. Caller needs to invoke ldapClient.authenticateCalled() to determine whether ldapClient.authenticate() needs to be invoked. Caller has that responsibility because caller needs to deal with the LDAP bind response, which might involve referrals, response controls, errors, etc. This method is responsible only for establishing the connection.

Returns:LdapClient

an LdapClient that is pooled.

isPoolingAllowedback to summary
pack-priv static boolean isPoolingAllowed(String socketFactory, OutputStream trace, String authMech, String protocol, Hashtable<?, ?> env) throws NamingException

Determines whether pooling is allowed given information on how the connection will be used. Non-configurable rejections: - nonstandard socketFactory has been specified: the pool manager cannot track input or parameters used by the socket factory and thus has no way of determining whether two connection requests are equivalent. Maybe in the future it might add a list of allowed socket factories to be configured - trace enabled (except when debugging) - for Digest authentication, if a callback handler has been specified: the pool manager cannot track input collected by the handler and thus has no way of determining whether two connection requests are equivalent. Maybe in the future it might add a list of allowed callback handlers. Configurable tests: - Pooling for the requested protocol (plain or ssl) is supported - Pooling for the requested authentication mechanism is supported

showStatsback to summary
public static void showStats(PrintStream out)
startCleanerThreadback to summary
private static void startCleanerThread()