diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2015-09-08 21:34:23 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2015-09-08 21:34:23 +0200 |
| commit | 415c6e6fc68251358f393cc551da180fb911346d (patch) | |
| tree | a7688bdeeeff11ed32d6b695022b31e1a9bc5567 | |
| parent | 7a48019d3c9c5dbf4c10d19065d8b790ce71f55d (diff) | |
Make sure LDAPConnections are cleaned up on login, and if connect is
called again.
| -rw-r--r-- | src/main/java/com/c2kernel/process/Gateway.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index 2ce4d26..eed75a0 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -25,6 +25,7 @@ import com.c2kernel.utils.FileStringUtility; import com.c2kernel.utils.Language;
import com.c2kernel.utils.Logger;
import com.c2kernel.utils.Resource;
+import com.novell.ldap.LDAPConnection;
/**************************************************************************
@@ -178,6 +179,9 @@ public class Gateway throws InvalidDataException,
ClusterStorageException
{
+ if (mLDAPLookup!=null)
+ mLDAPLookup.disconnect();
+
LDAPProperties ldapProps = new LDAPProperties();
if( ldapProps.mHost != null && ldapProps.mPort != null &&
@@ -226,7 +230,8 @@ public class Gateway ldapProps.mPassword = agentPassword;
try {
- LDAPLookup.createConnection(ldapProps);
+ LDAPConnection login = LDAPLookup.createConnection(ldapProps);
+ login.disconnect();
return (AgentProxy)getProxyManager().getProxy(mLDAPLookup.getRoleManager().getAgentPath(agentName));
} catch (Exception ex) {
Logger.error(ex);
@@ -246,7 +251,9 @@ public class Gateway static public AgentProxy connect(String agentName, String agentPassword)
throws InvalidDataException, ObjectNotFoundException
{
-
+ if (mLDAPLookup!=null)
+ mLDAPLookup.disconnect();
+
LDAPProperties ldapProps = new LDAPProperties();
if (ldapProps.mHost!=null && ldapProps.mPort!= null && ldapProps.mLocalPath!=null )
{
|
