Improved idle timeout mechanism.
This commit is contained in:
parent
a64319b9b1
commit
8f41e33938
|
@ -26,7 +26,6 @@ import java.util.Enumeration;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.eclipse.jetty.client.api.Response;
|
||||
|
@ -432,13 +431,6 @@ public abstract class HttpReceiver
|
|||
responseState.set(ResponseState.FAILURE);
|
||||
}
|
||||
|
||||
public void idleTimeout()
|
||||
{
|
||||
// If we cannot fail, it means a response arrived
|
||||
// just when we were timeout idling, so we don't close
|
||||
responseFailure(new TimeoutException());
|
||||
}
|
||||
|
||||
public boolean abort(Throwable cause)
|
||||
{
|
||||
return responseFailure(cause);
|
||||
|
|
|
@ -103,11 +103,6 @@ public class HttpChannelOverHTTP extends HttpChannel
|
|||
}
|
||||
}
|
||||
|
||||
public void idleTimeout()
|
||||
{
|
||||
receiver.idleTimeout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.eclipse.jetty.client.http;
|
||||
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.HttpConnection;
|
||||
import org.eclipse.jetty.client.HttpDestination;
|
||||
|
@ -93,21 +95,12 @@ public class HttpConnectionOverHTTP extends AbstractConnection implements Connec
|
|||
|
||||
HttpExchange exchange = channel.getHttpExchange();
|
||||
if (exchange != null)
|
||||
idleTimeout();
|
||||
else
|
||||
getHttpDestination().remove(this);
|
||||
return exchange.getRequest().abort(new TimeoutException());
|
||||
|
||||
getHttpDestination().remove(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void idleTimeout()
|
||||
{
|
||||
// TODO: we need to fail the exchange if we did not get an answer from the server
|
||||
// TODO: however this mechanism does not seem to be available in SPDY if not subclassing SPDYConnection
|
||||
// TODO: but the API (Session) does not have such facilities; perhaps we need to add a callback to ISession
|
||||
channel.idleTimeout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFillable()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue