Merge pull request #2953 from eclipse/jetty-9.4.x-859-httpclient_stack_overflow
Fixes #859 - Stack overflow error in jetty high level API.
This commit is contained in:
commit
a056695687
|
@ -19,6 +19,8 @@
|
||||||
package org.eclipse.jetty.client;
|
package org.eclipse.jetty.client;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -338,18 +340,31 @@ public abstract class HttpSender implements AsyncContentProvider.Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean anyToFailure(Throwable failure)
|
private void anyToFailure(Throwable failure)
|
||||||
{
|
{
|
||||||
HttpExchange exchange = getHttpExchange();
|
HttpExchange exchange = getHttpExchange();
|
||||||
if (exchange == null)
|
if (exchange == null)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
// Mark atomically the request as completed, with respect
|
// Mark atomically the request as completed, with respect
|
||||||
// to concurrency between request success and request failure.
|
// to concurrency between request success and request failure.
|
||||||
if (exchange.requestComplete(failure))
|
if (exchange.requestComplete(failure))
|
||||||
return abort(exchange, failure);
|
executeAbort(exchange, failure);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
private void executeAbort(HttpExchange exchange, Throwable failure)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Executor executor = getHttpChannel().getHttpDestination().getHttpClient().getExecutor();
|
||||||
|
executor.execute(() -> abort(exchange, failure));
|
||||||
|
}
|
||||||
|
catch (RejectedExecutionException x)
|
||||||
|
{
|
||||||
|
if (LOG.isDebugEnabled())
|
||||||
|
LOG.debug(x);
|
||||||
|
abort(exchange, failure);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void terminateRequest(HttpExchange exchange)
|
private void terminateRequest(HttpExchange exchange)
|
||||||
|
|
Loading…
Reference in New Issue