git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1545 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-04-21 12:56:06 +00:00
parent 28ead0cdbe
commit 5da4ce77c0
2 changed files with 10 additions and 59 deletions

View File

@ -15,7 +15,6 @@ package org.eclipse.jetty.client;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.net.SocketTimeoutException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -296,19 +295,8 @@ public class HttpDestination
if (_queue.size() > 0) if (_queue.size() > 0)
{ {
HttpExchange ex = _queue.removeFirst(); HttpExchange ex = _queue.removeFirst();
ex.setStatus(HttpExchange.STATUS_EXCEPTED);
if (throwable instanceof SocketTimeoutException || ex.getEventListener().onException(throwable);
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);
}
} }
} }
} }

View File

@ -15,6 +15,7 @@
package org.eclipse.jetty.client; package org.eclipse.jetty.client;
import java.io.IOException; import java.io.IOException;
import java.net.SocketTimeoutException;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
@ -315,48 +316,7 @@ public abstract class AbstractHttpExchangeCancelTest extends TestCase
httpClient.setTimeout(1000); httpClient.setTimeout(1000);
httpClient.start(); httpClient.start();
System.err.println("\n\n\nStart testHttpExchangeOnExpire "+this.getClass()); TestHttpExchange exchange = new TestHttpExchange();
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);
}
};
exchange.setAddress(newAddress()); exchange.setAddress(newAddress());
exchange.setURI("/?action=wait5000"); exchange.setURI("/?action=wait5000");
@ -364,7 +324,7 @@ public abstract class AbstractHttpExchangeCancelTest extends TestCase
int status = exchange.waitForDone(); int status = exchange.waitForDone();
assertEquals(HttpExchange.STATUS_EXPIRED, status); assertTrue(HttpExchange.STATUS_EXPIRED==status||HttpExchange.STATUS_EXCEPTED==status);
assertFalse(exchange.isResponseCompleted()); assertFalse(exchange.isResponseCompleted());
assertFalse(exchange.isFailed()); assertFalse(exchange.isFailed());
assertTrue(exchange.isExpired()); assertTrue(exchange.isExpired());
@ -437,8 +397,11 @@ public abstract class AbstractHttpExchangeCancelTest extends TestCase
@Override @Override
protected void onException(Throwable ex) protected void onException(Throwable ex)
{ {
// ex.printStackTrace(); if (ex instanceof SocketTimeoutException ||
this.failed = true; ex.getCause() instanceof SocketTimeoutException)
expired=true;
else
failed = true;
} }
public boolean isFailed() public boolean isFailed()