Skip to content

Commit 3e4d305

Browse files
committed
Polish ReactorResourceFactory
1 parent 7a0c03e commit 3e4d305

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

spring-web/src/main/java/org/springframework/http/client/reactive/ReactorResourceFactory.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,25 @@ public void afterPropertiesSet() throws Exception {
143143
@Override
144144
public void destroy() {
145145

146-
Assert.notNull(this.connectionProvider, "No ConnectionProvider");
147-
this.connectionProvider.dispose();
146+
try {
147+
ConnectionProvider provider = this.connectionProvider;
148+
if (provider != null) {
149+
provider.dispose();
150+
}
151+
}
152+
catch (Throwable ex) {
153+
// ignore
154+
}
148155

149-
Assert.notNull(this.loopResources, "No LoopResources");
150-
this.loopResources.dispose();
156+
try {
157+
LoopResources resources = this.loopResources;
158+
if (resources != null) {
159+
resources.dispose();
160+
}
161+
}
162+
catch (Throwable ex) {
163+
// ignore
164+
}
151165
}
152166

153167
}

src/docs/asciidoc/web/webflux-webclient.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ concurrency. In this mode global resources remain active until the process exits
9595
If the server is timed with the process, there is typically no need for an explicit
9696
shutdown. However if the server can start or stop in-process, e.g. Spring MVC
9797
application deployed as a WAR, you can declare a Spring-managed bean of type
98-
`ReactorResourceFactory` with `globaResources=true` (the default) to ensure the Reactor
98+
`ReactorResourceFactory` with `globalResources=true` (the default) to ensure the Reactor
9999
Netty global resources are shut down when the Spring `ApplicationContext` is closed:
100100

101101
[source,java,intent=0]

0 commit comments

Comments
 (0)