diff --git a/src/main/java/io/vertx/core/http/impl/Http1xClientConnection.java b/src/main/java/io/vertx/core/http/impl/Http1xClientConnection.java index bbbd0587e..fcdea9d7f 100644 --- a/src/main/java/io/vertx/core/http/impl/Http1xClientConnection.java +++ b/src/main/java/io/vertx/core/http/impl/Http1xClientConnection.java @@ -370,6 +370,9 @@ class Http1xClientConnection extends Http1xConnectionBase 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 impleme // ???? } } - handleException(cause); } @Override diff --git a/src/main/java/io/vertx/core/http/impl/HttpClientRequestBase.java b/src/main/java/io/vertx/core/http/impl/HttpClientRequestBase.java index c665cc510..6dcae2d47 100644 --- a/src/main/java/io/vertx/core/http/impl/HttpClientRequestBase.java +++ b/src/main/java/io/vertx/core/http/impl/HttpClientRequestBase.java @@ -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 Julien Viet */ @@ -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() { diff --git a/src/main/java/io/vertx/core/http/impl/NoStackTraceTimeoutException.java b/src/main/java/io/vertx/core/http/impl/NoStackTraceTimeoutException.java new file mode 100644 index 000000000..ffa6285c6 --- /dev/null +++ b/src/main/java/io/vertx/core/http/impl/NoStackTraceTimeoutException.java @@ -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; + } +}