文档

Java™ 教程-Java Tutorials 中文版
连接管理
Trail: Java Naming and Directory Interface
Lesson: Advanced Topics for LDAP Users

连接管理

JNDI provides a high-level interface for accessing naming and directory services. The mapping between a JNDI Context instance and an underlying network connection might not be one-to-one. The service provider is free to share and reuse connections as long as the interface semantics are preserved. The application developer usually does not need to know the details of how Context instances create and use connections. These details are useful when the developer needs to tune his program.

This lesson describes how the LDAP service provider uses connections. It describes when connections are created and how to specify special connection parameters, such as multiple servers and connection timeouts. This lesson also shows how to dynamically discover and use LDAP servers in network environments that support it.

A connection that is created must eventually be closed. This lesson contains a section that describes connection closures by the client and the server.

Finally, this lesson shows you how to use connection pooling to make applications that use many short-lived connections more efficient.


注意: Information presented in this lesson are specific to LDAP service provider in the JDK. LDAP service providers from other vendors might not use the same policies for managing connections.

Previous page: LDAP Unsolicited Notifications
Next page: Creation