- Когда я использую VirtualListViewControl, мне приходится использовать тот же LdapConnection, чтобы он работал.
- Когда я использую LdapConnectionPool, я не могу выбрать конкретное соединение.
Код: Выделить всё
connectionPool.releaseConnection(con)В случае VirtualListViewControl я необходимо иметь карту cookieid для LdapConnection.
Клиент может прокручивать довольно длительный период времени, поэтому резервирование соединения на такое долгое время выглядит избыточным.
На с другой стороны, мы разрываем соединение после первого запроса, что означает, что если пользователь продолжит прокрутку, LDAPConnection может использоваться одновременно разными потоками.
На основании Java-документа это безопасно:
Код: Выделить всё
/**
...
* 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:
* [list]
* [*]
* Using one of the {@code connect} methods to re-establish the connection.
*
* [*]
* Using one of the {@code close} methods to terminate the connection.
*
* [*]
* 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).
*
* [*]
* 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).
*
* [/list]
**/
@ThreadSafety(level=ThreadSafetyLevel.MOSTLY_THREADSAFE)
public final class LDAPConnection
implements FullLDAPInterface, LDAPConnectionInfo, ReferralConnector,
Closeable
{
Поэтому мой вопрос:
Что такое предпочтительный способ использования LdapConnectionPool вместе с VirtualListViewControl ?
Подробнее здесь: https://stackoverflow.com/questions/793 ... iewcontrol
Мобильная версия