LDAP Classes
Implements Java LDAP

com.novell.ldap.connectionpool
Class PoolManager

java.lang.Object
  extended bycom.novell.ldap.connectionpool.PoolManager

public class PoolManager
extends java.lang.Object

Manages connections to an LDAP Server.

PoolManager manages connections to a single LDAP server. The pool consists of a finite number of physical connections to the LDAP server (parameter maxConns) and a finite number of LDAPConnection objects sharing a physical connection (parameter maxSharedConns), see the PoolManager constructor.

A physical connection, and its shared LDAPConnection objects are associated with an LDAP DN and password (DN/PW). getBoundConnection searches for a physical connection associated with a given DN/PW and returns an available LDAPConnection object associated with that DN/PW. If none are available it searches for an unused physical connection, binds using the given DN/PW, and returns an LDAPConnection object. If no physical connection is available then it waits. Once an LDAPConnection object is no longer needed the makeConnectionAvailable function must be called to make the LDAPConnection available to other threads.


Constructor Summary
PoolManager(java.lang.String host, int port, int maxConns, int maxSharedConns, LDAPSocketFactory factory)
          Initialize the connection pool.
 
Method Summary
protected  void finalize()
          Free connections.
 LDAPConnection getBoundConnection(java.lang.String DN, byte[] PW)
          Get a bound connection.
 void makeConnectionAvailable(LDAPConnection conn)
          Make this connection available.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolManager

public PoolManager(java.lang.String host,
                   int port,
                   int maxConns,
                   int maxSharedConns,
                   LDAPSocketFactory factory)
            throws LDAPException
Initialize the connection pool.

Parameters:
host - - Host name associated with this connection pool (see LDAPConnection.connect()).
port - - Port number for the host associated with this connection pool. (see LDAPConnection.connect()).
maxConns - - Maximum number of physical connections allowed for this host.
maxSharedConns - - Maximum number of shared connections per physical connection.
factory - - A socket factory used to set an encrypted connection, or null if none. If the factory is an instance of LDAPTLSSocketFactory then a startTLS is performed after the connection to the server is established. LDAPTLSSocketFactory (see LDAPConnection.setSocketFactory()).
Method Detail

getBoundConnection

public LDAPConnection getBoundConnection(java.lang.String DN,
                                         byte[] PW)
                                  throws LDAPException,
                                         java.lang.InterruptedException
Get a bound connection.

This returns a bound (bind) connection for the desired DN and password.

Parameters:
DN - Authentication DN used for bind and key.
PW - Authentication password used for bind and key.
Throws:
LDAPException - if an LDAPConnection could not be bound.
java.lang.InterruptedException

makeConnectionAvailable

public void makeConnectionAvailable(LDAPConnection conn)
Make this connection available.

Parameters:
conn - LDAPConnection to be made available.

finalize

protected void finalize()
                 throws java.lang.Throwable
Free connections.

Tell all waiting threads that we are shutting down. Clean up the in use and available connections.

Throws:
java.lang.Throwable - when disconnect fails.

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000