geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r578315 - /geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java
Date Fri, 21 Sep 2007 23:10:33 GMT
Author: jgenender
Date: Fri Sep 21 16:10:33 2007
New Revision: 578315

URL: http://svn.apache.org/viewvc?rev=578315&view=rev
Log:
Add error handling for non able to connect

Modified:
    geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java

Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java?rev=578315&r1=578314&r2=578315&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java (original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/AsyncHttpClient.java Fri
Sep 21 16:10:33 2007
@@ -23,6 +23,7 @@
 import org.apache.ahc.codec.HttpProtocolCodecFactory;
 import org.apache.ahc.codec.HttpRequestMessage;
 import org.apache.ahc.ssl.TrustManagerFactoryImpl;
+import org.apache.ahc.util.AsyncHttpClientException;
 import org.apache.mina.common.*;
 import org.apache.mina.filter.SSLFilter;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
@@ -72,9 +73,8 @@
             connector = new SocketConnector();
         else
             connector = new SocketConnector(Runtime.getRuntime().availableProcessors(), threadPool);
-        //connector = new SocketConnector(Runtime.getRuntime().availableProcessors(), threadPool);
 
-        connector.getDefaultConfig().setConnectTimeout(connectionTimeout / 1000);
+        connector.getDefaultConfig().setConnectTimeout(this.connectionTimeout / 1000);
 
     }
 
@@ -145,8 +145,13 @@
 
                 sess.write(request);
             } else {
-                //TODO FIX ME
-                //           log.error("Not connected...exiting");
+                try{
+                    IoSession sess = future.getSession();
+                    request.getCallback().onException(new AsyncHttpClientException("Connection
failed."));
+                } catch (RuntimeIOException e){
+                    //Set the callback exception
+                    request.getCallback().onException(e);
+                }
             }
         }
 



Mime
View raw message