Avoid recording RestClient observations twice
Prior to this commit, the fix for gh-32575 introduced cases where the client observation would be stopped twice. This commit ensures that `RestClient` observations are stopped only once when the response is closed, or before throwing an unhanlded exception. Fixes gh-33068
This commit is contained in:
@@ -240,19 +240,16 @@ final class DefaultRestClient implements RestClient {
|
||||
ResolvableType.forType(bodyType) + "] and content type [" + contentType + "]", cause);
|
||||
if (observation != null) {
|
||||
observation.error(restClientException);
|
||||
observation.stop();
|
||||
}
|
||||
throw restClientException;
|
||||
}
|
||||
catch (RestClientException restClientException) {
|
||||
if (observation != null) {
|
||||
observation.error(restClientException);
|
||||
}
|
||||
throw restClientException;
|
||||
}
|
||||
finally {
|
||||
if (observation != null) {
|
||||
observation.stop();
|
||||
}
|
||||
throw restClientException;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user