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 Details

    • newInternalConnection

      public static Connection newInternalConnection(BiFunction<Integer,Request,Flowable<Response>> requestHandler)
      Creates a new Connection which will route requests to the provided requestHandler.

      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 - If requestHandler was null.
    • newInternalConnectionFactory

      public static ConnectionFactory newInternalConnectionFactory(BiFunction<Integer,Request,Flowable<Response>> requestHandler)
      Creates a new ConnectionFactory which will route requests to the provided requestHandler.

      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 - If requestHandler was null.
    • uncloseable

      public static Connection uncloseable(Connection connection)
      Returns an uncloseable view of the provided connection. Attempts to call Connection.close() or Connection.close(UnbindRequest, String) will be ignored.
      Parameters:
      connection - The connection whose close 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 call ConnectionFactory.close() will be ignored.
      Parameters:
      factory - The connection factory whose close method is to be disabled.
      Returns:
      An uncloseable view of the provided connection factory.