Reputation: 37106
Let's consider following statements:
LdapConnection
to make it working.I checked omplementation of LdapConnectionPool and noticed that pool gives the connection to the client, then client does an operation(s) and when everuthing is ready clien has to call:
connectionPool.releaseConnection(con)
Until this call - the connection won't be returned to any client.
In case of VirtualListViewControl
I have to have a map of cookieid to LdapConnection.
Client can make a scroll quite a long period of time so reserving the connection for such a long time looks redundant. On the other side we release the connection after first request means that if user continue scrolling LDAPConnection could be used at the same time by different threads.
Based on java doc it is safe:
/**
...
* This class is mostly threadsafe. It is possible to process multiple
* concurrent operations over the same connection as long as the methods being
* invoked will not change the state of the connection in a way that might
* impact other operations in progress in unexpected ways. In particular, the
* following should not be attempted while any other operations may be in
* progress on this connection:
* <UL>
* <LI>
* Using one of the {@code connect} methods to re-establish the connection.
* </LI>
* <LI>
* Using one of the {@code close} methods to terminate the connection.
* </LI>
* <LI>
* Using one of the {@code bind} methods to attempt to authenticate the
* connection (unless you are certain that the bind will not impact the
* identity of the associated connection, for example by including the
* retain identity request control in the bind request if using the
* LDAP SDK in conjunction with a Ping Identity, UnboundID, or
* Nokia/Alcatel-Lucent 8661 Directory Server).
* </LI>
* <LI>
* Attempting to make a change to the way that the underlying communication
* is processed (e.g., by using the StartTLS extended operation to convert
* an insecure connection into a secure one).
* </LI>
* </UL>
**/
@ThreadSafety(level=ThreadSafetyLevel.MOSTLY_THREADSAFE)
public final class LDAPConnection
implements FullLDAPInterface, LDAPConnectionInfo, ReferralConnector,
Closeable
{
But for some reasons LdapConnectionPool won't return the connection until it is not released.
My question is: what is the preferred way to use LdapConnectionPool
together with VirtualListViewControl
?
Upvotes: 0
Views: 20