Package org.forgerock.opendj.ldap
Class SharedConnectionPool
- java.lang.Object
-
- org.forgerock.opendj.ldap.SharedConnectionPool
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConnectionPool
,LdapClient
public final class SharedConnectionPool extends Object implements ConnectionPool
A connection pool implementation for shared connections. A shared connection may run multiple requests concurrently at any time. For that reason a shared connection cannot be used to process a BIND request because a BIND request requires exclusive access to the connection. To process the BIND operations use theCachedConnectionPool
class instead.
This connection pool can sustain high throughput because multiple requests may run concurrently on the same connection allowing multiple requests to be packed in the same TCP PDU.
-
-
Constructor Summary
Constructors Constructor Description SharedConnectionPool​(LdapClient client, int poolSize)
Creates a shared connection pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Releases any resources associated with this connection pool.Single<LdapClientSocket>
connect()
Returns aSingle
which connects to a peer each time it is subscribed.String
toString()
-
-
-
Constructor Detail
-
SharedConnectionPool
public SharedConnectionPool​(LdapClient client, int poolSize)
Creates a shared connection pool.- Parameters:
client
- the LDAP client connection factorypoolSize
- the pool size
-
-
Method Detail
-
connect
public Single<LdapClientSocket> connect()
Description copied from interface:LdapClient
Returns aSingle
which connects to a peer each time it is subscribed.- Specified by:
connect
in interfaceLdapClient
- Returns:
- A
Single
which connects to a peer each time it is subscribed.
-
close
public void close()
Description copied from interface:ConnectionPool
Releases any resources associated with this connection pool. Pooled connections will be permanently closed and this connection pool will no longer be available for use.Attempts to use this connection pool after it has been closed will result in an
IllegalStateException
.Calling
close
on a connection pool which is already closed has no effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnectionPool
- Specified by:
close
in interfaceLdapClient
-
-