Extra sage-guards for concurrent connection endpoint acquisition and request execution cancellation
This commit is contained in:
parent
09f50cd80c
commit
d8d7ad37a3
|
@ -103,11 +103,11 @@ class InternalExecRuntime implements ExecRuntime, Cancellable {
|
|||
final LeaseRequest connRequest = manager.lease(id, route, connectionRequestTimeout, object);
|
||||
state = object;
|
||||
if (cancellableDependency != null) {
|
||||
cancellableDependency.setDependency(connRequest);
|
||||
if (cancellableDependency.isCancelled()) {
|
||||
connRequest.cancel();
|
||||
throw new RequestFailedException("Request aborted");
|
||||
}
|
||||
cancellableDependency.setDependency(connRequest);
|
||||
}
|
||||
try {
|
||||
final ConnectionEndpoint connectionEndpoint = connRequest.get(connectionRequestTimeout);
|
||||
|
@ -115,6 +115,10 @@ class InternalExecRuntime implements ExecRuntime, Cancellable {
|
|||
reusable = connectionEndpoint.isConnected();
|
||||
if (cancellableDependency != null) {
|
||||
cancellableDependency.setDependency(this);
|
||||
if (cancellableDependency.isCancelled()) {
|
||||
cancel();
|
||||
throw new RequestFailedException("Request aborted");
|
||||
}
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("{} acquired endpoint {}", id, ConnPoolSupport.getId(connectionEndpoint));
|
||||
|
|
Loading…
Reference in New Issue