From 46b939a2e4f79b7f2a033d00a98c33205befdcc3 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 29 Mar 2013 14:55:24 +0000
Subject: [PATCH] Additional change for OPENDJ-354: Implement a RequestHandler which provides an in-memory backend
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java
index 92c7641..6d5a0e5 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java
@@ -254,6 +254,36 @@
/**
* Creates a new connection factory which binds internal client connections
+ * to the provided {@link RequestHandler}s.
+ * <p>
+ * When processing requests, {@code RequestHandler} implementations are
+ * passed an integer as the first parameter. This integer represents a
+ * pseudo {@code requestID} which is incremented for each successive
+ * internal request on a per client connection basis. The request ID may be
+ * useful for logging purposes.
+ * <p>
+ * An internal connection factory does not require {@code 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.
+ *
+ * @param requestHandler
+ * The request handler which will be used for all client
+ * connections.
+ * @return The new internal connection factory.
+ * @throws NullPointerException
+ * If {@code requestHandler} was {@code null}.
+ */
+ public static ConnectionFactory newInternalConnectionFactory(
+ final RequestHandler<RequestContext> requestHandler) {
+ Validator.ensureNotNull(requestHandler);
+ return new InternalConnectionFactory<Void>(Connections
+ .<Void> newServerConnectionFactory(requestHandler), null);
+ }
+
+ /**
+ * Creates a new connection factory which binds internal client connections
* to {@link RequestHandler}s created using the provided
* {@link RequestHandlerFactory}.
* <p>
--
Gitblit v1.10.0