2120N/A * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Contains utilities for managing connection pools of LdapClient. 0N/A * Contains method for 0N/A * - checking whether attempted connection creation may be pooled 0N/A * - creating a pooled connection 0N/A * - closing idle connections. 0N/A * If a timeout period has been configured, then it will automatically 0N/A * close and remove idle connections (those that have not been 0N/A * used for the duration of the timeout period). 0N/A * @author Rosanna Lee 0N/A "com.sun.jndi.ldap.connect.pool.debug";
0N/A // ---------- System properties for connection pooling 0N/A // Authentication mechanisms of connections that may be pooled 0N/A "com.sun.jndi.ldap.connect.pool.authentication";
0N/A // Protocol types of connections that may be pooled 2312N/A "com.sun.jndi.ldap.connect.pool.protocol";
2312N/A // Maximum number of identical connections per pool 2312N/A "com.sun.jndi.ldap.connect.pool.maxsize";
0N/A // Preferred number of identical connections per pool 0N/A "com.sun.jndi.ldap.connect.pool.prefsize";
0N/A // Initial number of identical connections per pool 0N/A // Milliseconds to wait before closing idle connections 0N/A "com.sun.jndi.ldap.connect.pool.timeout";
0N/A // Properties for DIGEST 0N/A "java.naming.security.sasl.callback";
0N/A // --------- Constants 0N/A private static final int NONE =
0;
// indices into pools 0N/A // --------- static fields 0N/A private static final long idleTimeout;
// ms to wait before closing idle conn 0N/A // List of pools used for different auth types 0N/A // Determine supported authentication mechanisms 0N/A // Determine supported protocols 0N/A // Create cleaner to expire idle connections 0N/A // Cannot instantiate one of these 0N/A * Find the index of the pool for the specified mechanism. If not 0N/A * one of "none", "simple", "DIGEST-MD5", or "GSSAPI", 0N/A * @param mech mechanism type 0N/A * Determines whether pooling is allowed given information on how 0N/A * the connection will be used. 0N/A * Non-configurable rejections: 0N/A * - nonstandard socketFactory has been specified: the pool manager 0N/A * cannot track input or parameters used by the socket factory and 0N/A * thus has no way of determining whether two connection requests 2312N/A * are equivalent. Maybe in the future it might add a list of allowed 2312N/A * socket factories to be configured 2312N/A * - trace enabled (except when debugging) 2312N/A * - for Digest authentication, if a callback handler has been specified: 2312N/A * the pool manager cannot track input collected by the handler 2312N/A * and thus has no way of determining whether two connection requests are 0N/A * equivalent. Maybe in the future it might add a list of allowed 0N/A * Configurable tests: 0N/A * - Pooling for the requested protocol (plain or ssl) is supported 0N/A * - Pooling for the requested authentication mechanism is supported 2312N/A // Requesting plain protocol but it is not supported 2312N/A // Requesting ssl protocol but it is not supported 0N/A d(
"Pooling disallowed due to tracing or unsupported pooling of protocol");
0N/A // pooling of custom socket factory is possible only if the 0N/A // socket factory interface implements java.util.comparator 0N/A // Cannot use pooling if authMech is not a supported mechs 0N/A // Cannot use pooling if authMech contains multiple mechs 0N/A // Provider won't be able to determine connection identity 0N/A // if an alternate callback handler is used 0N/A * Obtains a pooled connection that either already exists or is 0N/A * newly created using the parameters supplied. If it is newly 0N/A * created, it needs to go through the authentication checks to 0N/A * determine whether an LDAP bind is necessary. 0N/A * Caller needs to invoke ldapClient.authenticateCalled() to 0N/A * determine whether ldapClient.authenticate() needs to be invoked. 0N/A * Caller has that responsibility because caller needs to deal 0N/A * with the LDAP bind response, which might involve referrals, 0N/A * response controls, errors, etc. This method is responsible only 0N/A * for establishing the connection. 0N/A * @return an LdapClient that is pooled. 0N/A // Create base identity for LdapClient 0N/A "Attempting to use pooling for an unsupported mechanism: " +
0N/A // Add identity information used in simple authentication 401N/A * Closes idle connections idle since specified time. 401N/A * @param threshold Close connections idle since this time, as 0N/A * specified in milliseconds since "the epoch". 0N/A * @see java.util.Date