mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Polishing in ReactorClientHttpConnector
This commit is contained in:
+5
-4
@@ -168,7 +168,7 @@ public class ReactorClientHttpConnector implements ClientHttpConnector, SmartLif
|
||||
.responseConnection((response, connection) -> {
|
||||
ReactorClientHttpResponse clientResponse = new ReactorClientHttpResponse(response, connection);
|
||||
responseRef.set(clientResponse);
|
||||
clearChannelAttribute(connection);
|
||||
registerAttributeCallback(connection);
|
||||
return Mono.just((ClientHttpResponse) clientResponse);
|
||||
})
|
||||
.next()
|
||||
@@ -198,12 +198,13 @@ public class ReactorClientHttpConnector implements ClientHttpConnector, SmartLif
|
||||
return new ReactorClientHttpRequest(method, uri, request, nettyOutbound);
|
||||
}
|
||||
|
||||
private static void clearChannelAttribute(Connection connection) {
|
||||
connection.onTerminate().subscribe(
|
||||
aVoid -> {}, ex -> clearAttribute(connection), () -> clearAttribute(connection));
|
||||
private static void registerAttributeCallback(Connection connection) {
|
||||
connection.onTerminate().subscribe(aVoid -> {},
|
||||
ex -> clearAttribute(connection), () -> clearAttribute(connection));
|
||||
}
|
||||
|
||||
private static void clearAttribute(Connection connection) {
|
||||
// Deprecation note on remove method: consider using set(Object) (with value of null)
|
||||
connection.channel().attr(ATTRIBUTES_KEY).set(null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user