Always bind the exchange ID to the execution context
This commit is contained in:
parent
013851d898
commit
5390aef223
|
@ -656,6 +656,7 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
|
|||
try {
|
||||
final SimpleHttpResponse cacheResponse = generateCachedResponse(request, context, entry, now);
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
context.setExchangeId(exchangeId);
|
||||
final AsyncExecChain.Scope fork = new AsyncExecChain.Scope(
|
||||
exchangeId,
|
||||
scope.route,
|
||||
|
|
|
@ -278,6 +278,7 @@ class CachingExec extends CachingExecBase implements ExecChainHandler {
|
|||
&& validityPolicy.mayReturnStaleWhileRevalidating(entry, now)) {
|
||||
LOG.debug("Serving stale with asynchronous revalidation");
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
context.setExchangeId(exchangeId);
|
||||
final ExecChain.Scope fork = new ExecChain.Scope(
|
||||
exchangeId,
|
||||
scope.route,
|
||||
|
|
|
@ -188,12 +188,12 @@ abstract class InternalAbstractHttpAsyncClient extends AbstractHttpAsyncClientBa
|
|||
httpHost != null ? httpHost : RoutingSupport.determineHost(request),
|
||||
clientContext);
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
clientContext.setExchangeId(exchangeId);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("{} preparing request execution", exchangeId);
|
||||
}
|
||||
final AsyncExecRuntime execRuntime = createAsyncExecRuntime(pushHandlerFactory);
|
||||
|
||||
clientContext.setExchangeId(exchangeId);
|
||||
setupContext(clientContext);
|
||||
|
||||
final AsyncExecChain.Scheduler scheduler = this::executeScheduled;
|
||||
|
|
|
@ -213,7 +213,10 @@ public final class MinimalH2AsyncClient extends AbstractMinimalHttpAsyncClientBa
|
|||
};
|
||||
if (LOG.isDebugEnabled()) {
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
LOG.debug("{} executing message exchange {}", exchangeId, ConnPoolSupport.getId(session));
|
||||
clientContext.setExchangeId(exchangeId);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("{} executing message exchange {}", exchangeId, ConnPoolSupport.getId(session));
|
||||
}
|
||||
session.enqueue(
|
||||
new RequestExecutionCommand(
|
||||
new LoggingAsyncClientExchangeHandler(LOG, exchangeId, internalExchangeHandler),
|
||||
|
|
|
@ -136,6 +136,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
|
|||
final HttpRoute route = new HttpRoute(RoutingSupport.normalize(host, schemePortResolver));
|
||||
final ComplexFuture<AsyncConnectionEndpoint> resultFuture = new ComplexFuture<>(callback);
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
clientContext.setExchangeId(exchangeId);
|
||||
final Future<AsyncConnectionEndpoint> leaseFuture = manager.lease(
|
||||
exchangeId,
|
||||
route,
|
||||
|
@ -445,16 +446,18 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
|
|||
final HttpContext context) {
|
||||
Asserts.check(!released.get(), "Endpoint has already been released");
|
||||
|
||||
final HttpClientContext clientContext = context != null ? HttpClientContext.adapt(context) : HttpClientContext.create();
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
clientContext.setExchangeId(exchangeId);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("{} executing message exchange {}", exchangeId, ConnPoolSupport.getId(connectionEndpoint));
|
||||
connectionEndpoint.execute(
|
||||
exchangeId,
|
||||
new LoggingAsyncClientExchangeHandler(LOG, exchangeId, exchangeHandler),
|
||||
pushHandlerFactory,
|
||||
context);
|
||||
clientContext);
|
||||
} else {
|
||||
connectionEndpoint.execute(exchangeId, exchangeHandler, context);
|
||||
connectionEndpoint.execute(exchangeId, exchangeHandler, clientContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ class InternalHttpClient extends CloseableHttpClient implements Configurable {
|
|||
target != null ? target : RoutingSupport.determineHost(request),
|
||||
localcontext);
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
localcontext.setExchangeId(exchangeId);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("{} preparing request execution", exchangeId);
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ public class MinimalHttpClient extends CloseableHttpClient {
|
|||
|
||||
final HttpRoute route = new HttpRoute(RoutingSupport.normalize(target, schemePortResolver));
|
||||
final String exchangeId = ExecSupport.getNextExchangeId();
|
||||
clientContext.setExchangeId(exchangeId);
|
||||
final ExecRuntime execRuntime = new InternalExecRuntime(LOG, connManager, requestExecutor,
|
||||
request instanceof CancellableDependency ? (CancellableDependency) request : null);
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue