mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Make sure that the reset cause of an HttpClient timeout will always happen before the connection close (when it's needed), also make the timeout exception subclass not an inner class
This commit is contained in:
@@ -370,6 +370,9 @@ class Http1xClientConnection extends Http1xConnectionBase<WebSocketImpl> impleme
|
||||
return;
|
||||
}
|
||||
reset = true;
|
||||
}
|
||||
handleException(cause);
|
||||
synchronized (conn) {
|
||||
if (conn.requestInProgress == this) {
|
||||
if (request == null) {
|
||||
// Is that possible in practice ???
|
||||
@@ -383,7 +386,6 @@ class Http1xClientConnection extends Http1xConnectionBase<WebSocketImpl> impleme
|
||||
// ????
|
||||
}
|
||||
}
|
||||
handleException(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,8 +20,6 @@ import io.vertx.core.http.HttpMethod;
|
||||
import io.vertx.core.http.StreamResetException;
|
||||
import io.vertx.core.net.SocketAddress;
|
||||
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
|
||||
*/
|
||||
@@ -139,12 +137,7 @@ public abstract class HttpClientRequestBase implements HttpClientRequest {
|
||||
}
|
||||
}
|
||||
String msg = "The timeout period of " + timeoutMs + "ms has been exceeded while executing " + method + " " + uri + " for server " + server;
|
||||
reset(new TimeoutException(msg) {
|
||||
@Override
|
||||
public synchronized Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
});
|
||||
reset(new NoStackTraceTimeoutException(msg));
|
||||
}
|
||||
|
||||
synchronized void dataReceived() {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
|
||||
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
*/
|
||||
package io.vertx.core.http.impl;
|
||||
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
class NoStackTraceTimeoutException extends TimeoutException {
|
||||
NoStackTraceTimeoutException(String message) {
|
||||
super(message);
|
||||
}
|
||||
@Override
|
||||
public synchronized Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user