Browse Source

Polish ReactorResourceFactory

pull/1928/head
Rossen Stoyanchev 6 years ago
parent
commit
3e4d305291
  1. 22
      spring-web/src/main/java/org/springframework/http/client/reactive/ReactorResourceFactory.java
  2. 2
      src/docs/asciidoc/web/webflux-webclient.adoc

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

@ -143,11 +143,25 @@ public class ReactorResourceFactory implements InitializingBean, DisposableBean
@Override @Override
public void destroy() { public void destroy() {
Assert.notNull(this.connectionProvider, "No ConnectionProvider"); try {
this.connectionProvider.dispose(); ConnectionProvider provider = this.connectionProvider;
if (provider != null) {
provider.dispose();
}
}
catch (Throwable ex) {
// ignore
}
Assert.notNull(this.loopResources, "No LoopResources"); try {
this.loopResources.dispose(); LoopResources resources = this.loopResources;
if (resources != null) {
resources.dispose();
}
}
catch (Throwable ex) {
// ignore
}
} }
} }

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

@ -95,7 +95,7 @@ concurrency. In this mode global resources remain active until the process exits
If the server is timed with the process, there is typically no need for an explicit If the server is timed with the process, there is typically no need for an explicit
shutdown. However if the server can start or stop in-process, e.g. Spring MVC shutdown. However if the server can start or stop in-process, e.g. Spring MVC
application deployed as a WAR, you can declare a Spring-managed bean of type application deployed as a WAR, you can declare a Spring-managed bean of type
`ReactorResourceFactory` with `globaResources=true` (the default) to ensure the Reactor `ReactorResourceFactory` with `globalResources=true` (the default) to ensure the Reactor
Netty global resources are shut down when the Spring `ApplicationContext` is closed: Netty global resources are shut down when the Spring `ApplicationContext` is closed:
[source,java,intent=0] [source,java,intent=0]

Loading…
Cancel
Save