From 72650d4cc41c64136d064967d7fec3726d850fee Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 14 Oct 2010 11:52:28 +0000
Subject: [PATCH] Multiple enhancements and bug fixes to the SDK (update from OpenDS by matthew_swift):
---
sdk/src/org/opends/sdk/InternalConnectionFactory.java | 34 +++++++++++++++++++++++++++++++---
1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/sdk/src/org/opends/sdk/InternalConnectionFactory.java b/sdk/src/org/opends/sdk/InternalConnectionFactory.java
index 8749d7a..90d248e 100644
--- a/sdk/src/org/opends/sdk/InternalConnectionFactory.java
+++ b/sdk/src/org/opends/sdk/InternalConnectionFactory.java
@@ -35,8 +35,20 @@
/**
- * A special {@code ConnectionFactory} that can be used to perform internal
- * operations against a {@code ServerConnectionFactory} implementation.
+ * A special {@code ConnectionFactory} which waits for internal connection
+ * requests and binds them to a {@link ServerConnection} created using the
+ * provided {@link ServerConnectionFactory}.
+ * <p>
+ * When processing requests, {@code ServerConnection} 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 connection basis. The request ID may be useful for logging purposes.
+ * <p>
+ * An {@code InternalConnectionFactory} does not require
+ * {@code ServerConnection} 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 <C>
* The type of client context.
@@ -66,7 +78,7 @@
final ServerConnection<Integer> serverConnection;
try
{
- serverConnection = factory.accept(clientContext);
+ serverConnection = factory.handleAccept(clientContext);
}
catch (final ErrorResultException e)
{
@@ -85,4 +97,20 @@
}
return new CompletedFutureResult<AsynchronousConnection>(connection);
}
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("InternalConnectionFactory(");
+ builder.append(String.valueOf(clientContext));
+ builder.append(',');
+ builder.append(String.valueOf(factory));
+ builder.append(')');
+ return builder.toString();
+ }
}
--
Gitblit v1.10.0