From 32034d853f3a284424ccfa87b6de210f1ca814e1 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 29 Nov 2011 00:31:21 +0000
Subject: [PATCH] Fix OPENDJ-43 (Synchronous Connection decorator implementations should not use AsynchronousConnections) and OPENDJ-328 (Make it easier to implement connection decorators).
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
index bacf838..f0f4374 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
+ * Portions copyright 2011 ForgeRock AS.
*/
package org.forgerock.opendj.ldap;
@@ -30,7 +31,6 @@
import com.forgerock.opendj.ldap.InternalConnection;
-import com.forgerock.opendj.util.AbstractConnectionFactory;
import com.forgerock.opendj.util.CompletedFutureResult;
@@ -54,7 +54,7 @@
* @param <C>
* The type of client context.
*/
-final class InternalConnectionFactory<C> extends AbstractConnectionFactory
+final class InternalConnectionFactory<C> implements ConnectionFactory
{
private final ServerConnectionFactory<C, Integer> factory;
@@ -72,9 +72,24 @@
- @Override
- public FutureResult<AsynchronousConnection> getAsynchronousConnection(
- final ResultHandler<? super AsynchronousConnection> handler)
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getConnection() throws ErrorResultException,
+ InterruptedException
+ {
+ final ServerConnection<Integer> serverConnection = factory
+ .handleAccept(clientContext);
+ return new InternalConnection(serverConnection);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public FutureResult<Connection> getConnectionAsync(
+ final ResultHandler<? super Connection> handler)
{
final ServerConnection<Integer> serverConnection;
try
@@ -87,7 +102,7 @@
{
handler.handleErrorResult(e);
}
- return new CompletedFutureResult<AsynchronousConnection>(e);
+ return new CompletedFutureResult<Connection>(e);
}
final InternalConnection connection = new InternalConnection(
@@ -96,7 +111,7 @@
{
handler.handleResult(connection);
}
- return new CompletedFutureResult<AsynchronousConnection>(connection);
+ return new CompletedFutureResult<Connection>(connection);
}
--
Gitblit v1.10.0