directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1550786 - /directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Date Fri, 13 Dec 2013 18:07:37 GMT
Author: kayyagari
Date: Fri Dec 13 18:07:37 2013
New Revision: 1550786

URL: http://svn.apache.org/r1550786
Log:
applied timeout on the future while establishing a connection (DIRAPI-161)

Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1550786&r1=1550785&r2=1550786&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Fri Dec 13 18:07:37 2013
@@ -76,6 +76,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.exception.LdapNoPermissionException;
 import org.apache.directory.api.ldap.model.exception.LdapOperationException;
+import org.apache.directory.api.ldap.model.exception.LdapOtherException;
 import org.apache.directory.api.ldap.model.message.AbandonRequest;
 import org.apache.directory.api.ldap.model.message.AbandonRequestImpl;
 import org.apache.directory.api.ldap.model.message.AddRequest;
@@ -523,7 +524,16 @@ public class LdapNetworkConnection exten
         ConnectFuture connectionFuture = connector.connect( address );
 
         // Wait until it's established
-        connectionFuture.awaitUninterruptibly();
+        try
+        {
+            connectionFuture.await( timeout );
+        }
+        catch( InterruptedException e )
+        {
+            connector = null;
+            LOG.debug( "Interrupted while waiting for connection to establish with server
{}:{}", config.getLdapHost(), config.getLdapPort(), e );
+            throw new LdapOtherException( e.getMessage(), e );
+        }
 
         boolean isConnected = connectionFuture.isConnected();
 



Mime
View raw message