[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-commit] r1545 - in jetty/trunk/jetty-client/src: main/java/org/eclipse/jetty/client test/java/org/eclipse/jetty/client

Author: gwilkins
Date: 2010-04-21 08:56:06 -0400 (Wed, 21 Apr 2010)
New Revision: 1545

Modified:
   jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
   jetty/trunk/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java
Log:
debug

Modified: jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
===================================================================
--- jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java	2010-04-21 12:48:13 UTC (rev 1544)
+++ jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java	2010-04-21 12:56:06 UTC (rev 1545)
@@ -15,7 +15,6 @@
 
 import java.io.IOException;
 import java.lang.reflect.Constructor;
-import java.net.SocketTimeoutException;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -296,19 +295,8 @@
             if (_queue.size() > 0)
             {
                 HttpExchange ex = _queue.removeFirst();
-
-                if (throwable instanceof SocketTimeoutException ||
-                    throwable.getCause() instanceof SocketTimeoutException)
-                {
-                    Log.debug(throwable);
-                    ex.setStatus(HttpExchange.STATUS_EXPIRED);
-                    ex.getEventListener().onExpire();
-                }
-                else
-                {
-                    ex.setStatus(HttpExchange.STATUS_EXCEPTED);
-                    ex.getEventListener().onException(throwable);
-                }
+                ex.setStatus(HttpExchange.STATUS_EXCEPTED);
+                ex.getEventListener().onException(throwable);
             }
         }
     }

Modified: jetty/trunk/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java
===================================================================
--- jetty/trunk/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java	2010-04-21 12:48:13 UTC (rev 1544)
+++ jetty/trunk/jetty-client/src/test/java/org/eclipse/jetty/client/AbstractHttpExchangeCancelTest.java	2010-04-21 12:56:06 UTC (rev 1545)
@@ -15,6 +15,7 @@
 package org.eclipse.jetty.client;
 
 import java.io.IOException;
+import java.net.SocketTimeoutException;
 
 import javax.servlet.ServletException;
 import javax.servlet.ServletOutputStream;
@@ -315,48 +316,7 @@
         httpClient.setTimeout(1000);
         httpClient.start();
 
-        System.err.println("\n\n\nStart testHttpExchangeOnExpire "+this.getClass());
-        TestHttpExchange exchange = new TestHttpExchange()
-        {
-
-            /* ------------------------------------------------------------ */
-            /**
-             * @see org.eclipse.jetty.client.AbstractHttpExchangeCancelTest.TestHttpExchange#onException(java.lang.Throwable)
-             */
-            @Override
-            protected void onException(Throwable ex)
-            {
-                System.err.println("!!! onException");
-                ex.printStackTrace();
-                // TODO Auto-generated method stub
-                super.onException(ex);
-            }
-
-            /* ------------------------------------------------------------ */
-            /**
-             * @see org.eclipse.jetty.client.AbstractHttpExchangeCancelTest.TestHttpExchange#onExpire()
-             */
-            @Override
-            protected void onExpire()
-            {
-                System.err.println("EXPIRED");
-                // TODO Auto-generated method stub
-                super.onExpire();
-            }
-
-            /* ------------------------------------------------------------ */
-            /**
-             * @see org.eclipse.jetty.client.HttpExchange#onConnectionFailed(java.lang.Throwable)
-             */
-            @Override
-            protected void onConnectionFailed(Throwable x)
-            {
-                x.printStackTrace();
-                // TODO Auto-generated method stub
-                super.onConnectionFailed(x);
-            }
-            
-        };
+        TestHttpExchange exchange = new TestHttpExchange();
         exchange.setAddress(newAddress());
         exchange.setURI("/?action=wait5000");
 
@@ -364,7 +324,7 @@
 
         int status = exchange.waitForDone();
         
-        assertEquals(HttpExchange.STATUS_EXPIRED, status);
+        assertTrue(HttpExchange.STATUS_EXPIRED==status||HttpExchange.STATUS_EXCEPTED==status);
         assertFalse(exchange.isResponseCompleted());
         assertFalse(exchange.isFailed());
         assertTrue(exchange.isExpired());
@@ -437,8 +397,11 @@
         @Override
         protected void onException(Throwable ex)
         {
-            // ex.printStackTrace();
-            this.failed = true;
+            if (ex instanceof SocketTimeoutException ||
+                ex.getCause() instanceof SocketTimeoutException)
+                expired=true;
+            else
+                failed = true;
         }
 
         public boolean isFailed()