summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boreham <dboreham@redhat.com>2005-05-11 04:29:55 +0000
committerDavid Boreham <dboreham@redhat.com>2005-05-11 04:29:55 +0000
commit2e23e027f6ec5917e81537c129de8001c9a16b30 (patch)
tree045d6bffc4d86a98ff707875e99799244e75bf5f
parent1f4cbfd5edb3795ea523c33f0ad8827b3d785007 (diff)
downloadds-2e23e027f6ec5917e81537c129de8001c9a16b30.tar.gz
ds-2e23e027f6ec5917e81537c129de8001c9a16b30.tar.xz
ds-2e23e027f6ec5917e81537c129de8001c9a16b30.zip
Fix for #155588 : don't leak connections from the ldap connection pool
-rw-r--r--ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/BatchProcessor.java24
-rw-r--r--ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ProxyConnectionManager.java2
-rw-r--r--ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/gatewayHandler.java5
3 files changed, 10 insertions, 21 deletions
diff --git a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/BatchProcessor.java b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/BatchProcessor.java
index 7d0e3c4b..30cb1349 100644
--- a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/BatchProcessor.java
+++ b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/BatchProcessor.java
@@ -137,23 +137,10 @@ public class BatchProcessor {
}
-
- protected void finalize() {
- try { ldap_pool.shutdown(); }
- catch (Exception e) { }
- }
-
+
void process(int index) {
- netscape.ldap.LDAPConnection ldc = null;
-
- ldc = ldap_pool.getConnection("");
-
- if (ldc == null) {
- requests.set(index,null);
- }
- else {
-
- /* This is a hack:
+
+ /* This is a hack:
* This code is required because of Axis' incomplete
* implementation. Without these, whenever getNodeValue() and friends are
* called, exceptions are deliberately thrown. When Axis is fully
@@ -175,7 +162,6 @@ public class BatchProcessor {
Node res = null;
if (proxyAuth != null)
context.setConstraints( proxyAuth);
- context.setLdapConnection(ldc);
context.setRootNode(myRequest.cloneNode(true));
logger.log(Level.INFO, "Processing: starting {0}", RequestType);
@@ -236,9 +222,7 @@ public class BatchProcessor {
requests.set(index,res);
logger.log(Level.INFO, "Processing: finished {0}", RequestType);
FirstRequest = false;
-
- ldap_pool.releaseConnection("", ldc);
- }
+ ldap_pool.releaseConnection( context.getLdapConnection() );
}
diff --git a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ProxyConnectionManager.java b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ProxyConnectionManager.java
index 7b83939b..86577c2a 100644
--- a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ProxyConnectionManager.java
+++ b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ProxyConnectionManager.java
@@ -205,7 +205,7 @@ class ProxyConnectionManager implements IConnectionManager {
return;
// reset the original constraints
- conn.setSearchConstraints(_defaultSearchConstraints);
+ //conn.setSearchConstraints(_defaultSearchConstraints);
// A soft close on the connection.
// Returns the connection to the pool and make it available.
diff --git a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/gatewayHandler.java b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/gatewayHandler.java
index 6f281d63..faa3f5f7 100644
--- a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/gatewayHandler.java
+++ b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/gatewayHandler.java
@@ -89,6 +89,11 @@ public class gatewayHandler extends BasicHandler {
super.cleanup();
}
+
+ protected void finalize() {
+ new ProxyConnMgrFactory().getInstance().shutdown();
+ }
+
public boolean handleRequest(MessageContext context) {
/*