From 7057e430ce059963724928296ff166e68b4e2ebb Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 09 Apr 2013 09:58:22 +0000
Subject: [PATCH] Partial fix for OPENDJ-856: Make Rest2LDAP close the cached authenticated connection
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connections.java | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 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 6d5a0e5..deea05a 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
@@ -22,7 +22,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions copyright 2011-2012 ForgeRock AS
+ * Portions copyright 2011-2013 ForgeRock AS
*/
package org.forgerock.opendj.ldap;
@@ -472,6 +472,30 @@
return new RequestHandlerFactoryAdapter<C>(factory);
}
+ /**
+ * Returns an uncloseable view of the provided connection. Attempts to call
+ * {@link Connection#close()} or
+ * {@link Connection#close(org.forgerock.opendj.ldap.requests.UnbindRequest, String)}
+ * will be ignored.
+ *
+ * @param connection
+ * The connection whose {@code close} methods are to be disabled.
+ * @return An uncloseable view of the provided connection.
+ */
+ public static Connection uncloseable(Connection connection) {
+ return new AbstractConnectionWrapper(connection) {
+ @Override
+ public void close() {
+ // Do nothing.
+ }
+
+ public void close(org.forgerock.opendj.ldap.requests.UnbindRequest request,
+ String reason) {
+ // Do nothing.
+ };
+ };
+ }
+
// Prevent instantiation.
private Connections() {
// Do nothing.
--
Gitblit v1.10.0