Class Connections
- java.lang.Object
-
- org.forgerock.opendj.ldap.Connections
-
public final class Connections extends Object
This class contains methods for creating and manipulating LDAP clients and connections.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Connection
newInternalConnection(BiFunction<Integer,Request,Flowable<Response>> requestHandler)
Creates a newConnection
which will route requests to the providedrequestHandler
.static ConnectionFactory
newInternalConnectionFactory(BiFunction<Integer,Request,Flowable<Response>> requestHandler)
Creates a newConnectionFactory
which will route requests to the providedrequestHandler
.static Connection
uncloseable(Connection connection)
Returns an uncloseable view of the provided connection.static ConnectionFactory
uncloseable(ConnectionFactory factory)
Returns an uncloseable view of the provided connection factory.
-
-
-
Method Detail
-
newInternalConnection
public static Connection newInternalConnection(BiFunction<Integer,Request,Flowable<Response>> requestHandler)
Creates a newConnection
which will route requests to the providedrequestHandler
.When processing requests,
requestHandler
implementations are passed a pseudo request ID which is incremented for each successive internal request on a per client connection basis. The request ID may be useful for logging purposes.An internal connection does not require
requestHandler
implementations to return a result when processing requests. However, it is recommended that implementations do always return results even for abandoned requests. This is because application client threads may block indefinitely waiting for results.- Parameters:
requestHandler
- The request handler which will be used for all client connections.- Returns:
- The new internal connection.
- Throws:
NullPointerException
- IfrequestHandler
wasnull
.
-
newInternalConnectionFactory
public static ConnectionFactory newInternalConnectionFactory(BiFunction<Integer,Request,Flowable<Response>> requestHandler)
Creates a newConnectionFactory
which will route requests to the providedrequestHandler
.When processing requests,
requestHandler
implementations are passed a pseudo request ID which is incremented for each successive internal request on a per client connection basis. The request ID may be useful for logging purposes.An internal connection does not require
requestHandler
implementations to return a result when processing requests. However, it is recommended that implementations do always return results even for abandoned requests. This is because application client threads may block indefinitely waiting for results.- Parameters:
requestHandler
- The request handler which will be used for all client connections.- Returns:
- The new internal LDAP client.
- Throws:
NullPointerException
- IfrequestHandler
wasnull
.
-
uncloseable
public static Connection uncloseable(Connection connection)
Returns an uncloseable view of the provided connection. Attempts to callConnection.close()
orConnection.close(UnbindRequest, String)
will be ignored.- Parameters:
connection
- The connection whoseclose
methods are to be disabled.- Returns:
- An uncloseable view of the provided connection.
-
uncloseable
public static ConnectionFactory uncloseable(ConnectionFactory factory)
Returns an uncloseable view of the provided connection factory. Attempts to callConnectionFactory.close()
will be ignored.- Parameters:
factory
- The connection factory whoseclose
method is to be disabled.- Returns:
- An uncloseable view of the provided connection factory.
-
-