aicas logo Jamaica 3.4 release 8

com.sun.jndi.ldap
Class LdapClient

java.lang.Object
  extended by com.sun.jndi.ldap.LdapClient
All Implemented Interfaces:
PooledConnection

public final class LdapClient
extends Object
implements PooledConnection

LDAP (RFC-1777) and LDAPv3 (RFC-2251) compliant client This class represents a connection to an LDAP client. Callers interact with this class at an LDAP operation level. That is, the caller invokes a method to do a SEARCH or MODRDN operation and gets back the result. The caller uses the constructor to create a connection to the server. It then needs to use authenticate() to perform an LDAP BIND. Note that for v3, BIND is optional so authenticate() might not actually send a BIND. authenticate() can be used later on to issue a BIND, for example, for a v3 client that wants to change the connection's credentials.

Multiple LdapCtx might share the same LdapClient. For example, contexts derived from the same initial context would share the same LdapClient until changes to a context's properties necessitates its own LdapClient. LdapClient methods that access shared data are thread-safe (i.e., caller does not have to sync).

Fields: isLdapv3 - no sync; initialized and updated within sync authenticate(); always updated when connection is "quiet" and not shared; read access from outside LdapClient not sync referenceCount - sync within LdapClient; exception is forceClose() which is used by Connection thread to close connection upon receiving an Unsolicited Notification. access from outside LdapClient must sync; conn - no sync; Connection takes care of its own sync unsolicited - sync Vector; multiple operations sync'ed


Method Summary
 void closeConnection()
          Closes the physical connection.
protected  void finalize()
          finalize may be called by the memory management of the virtual machine when it determined that this instance's memory is unreachable and can be reclaimed.
 LdapResult ldapBind(String dn, byte[] toServer, Control[] bindCtls, String auth, boolean pauseAfterReceipt)
          Sends an LDAP Bind request.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

ldapBind

public LdapResult ldapBind(String dn,
                           byte[] toServer,
                           Control[] bindCtls,
                           String auth,
                           boolean pauseAfterReceipt)
                    throws IOException,
                           NamingException
Sends an LDAP Bind request. Cannot be private; called by LdapSasl

Parameters:
dn - The possibly null DN to use in the BIND request. null if anonymous.
toServer - The possibly null array of bytes to send to the server.
auth - The authentication mechanism
Throws:
IOException
NamingException

finalize

protected void finalize()
Description copied from class: Object
finalize may be called by the memory management of the virtual machine when it determined that this instance's memory is unreachable and can be reclaimed.

NOTE: The use of finalize() is strongly discouraged for realtime or safety-critical code. This method should only be used for debugging purposes. If used as a last resort to reclaim non-memory resouces, finalize() should indicate the resource leak with a loud error message.

There is no guarantee that finalize() will be called, the memory management may decide not to reclaim this object's memory or to delay the call to finalize() to an unspecified point in time. It is therefore recommended never to use the finalize method to release any resources (files, network connections, non-Java memory, etc.) since releasing of these resource may be delayed perpetually.

The order of finalization is not specified, i.e., the finalize method of any two objects that become unreachable may be called in an arbitrary order. It therefore has to be assumed that when finalize() is called on an object, that the finalize() method of any object that is only reachable through this object() has been called as well or is called simultaneously by another thread.

The presence of a finalize-method in any sub-class of Object causes the reclamation of the memory of this object to be delayed until the finalize() method has been executed. The finalize() method is typically executed by the finalizer thread (that may run at a low priority) or by a call to Runtime.runFinalization().

Any code sequence that creates instances of a class that defines a finalize() method must therefore ensure that sufficient CPU time is allocated to the finalizer thread or that Runtime.runFinalization() is called regularly such that the finalize() methods can be executed and the object's memory can be reclaimed.

The finalize method itself should never block or run for long times since it would otherwise block the finalizer thread or the thread that called Runtime.runFinalization() and prevent the execution other finalize() method and consequently prevent the reclamation of these object's memory.

For objects that are allocated in a javax.realtime.ScopedMemory, the finalize() methods will be called when this scoped memory is exited by the last thread. Unlike HeapMemory, which is controlled by the garbage collector, ScopedMemory provides a defined execution point for the finalize() mehods and it is therefore safer to use finalize() here.

Overrides:
finalize in class Object

closeConnection

public void closeConnection()
Description copied from interface: PooledConnection
Closes the physical connection.

Specified by:
closeConnection in interface PooledConnection

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.