public interface ConnectionPool extends ConnectionFactory
When connection pools are no longer needed they must be explicitly closed in order to close any remaining pooled connections.
Since pooled connections are re-used, applications must use operations such as binds and StartTLS with extreme caution.
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases any resources associated with this connection pool.
|
Connection |
getConnection()
Obtains a connection from this connection pool, potentially opening a new
connection if needed.
|
Promise<Connection,LdapException> |
getConnectionAsync()
Asynchronously obtains a connection from this connection pool,
potentially opening a new connection if needed.
|
void close()
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.
close
in interface AutoCloseable
close
in interface Closeable
close
in interface ConnectionFactory
Connections.uncloseable(ConnectionFactory)
Promise<Connection,LdapException> getConnectionAsync()
The returned Promise
can be used to retrieve the pooled
connection.
Closing the pooled connection will, depending on the connection pool implementation, return the connection to this pool without closing it.
getConnectionAsync
in interface ConnectionFactory
IllegalStateException
- If this connection pool has already been closed.Connection getConnection() throws LdapException
Closing the pooled connection will, depending on the connection pool implementation, return the connection to this pool without closing it.
getConnection
in interface ConnectionFactory
LdapException
- If the connection request failed for some reason.IllegalStateException
- If this connection pool has already been closed.Copyright 2010-2017 ForgeRock AS.