use of reactor.netty.http.HttpResources in project spring-framework by spring-projects.
the class ReactorResourceFactoryTests method globalResources.
@Test
void globalResources() throws Exception {
this.resourceFactory.setUseGlobalResources(true);
this.resourceFactory.afterPropertiesSet();
HttpResources globalResources = HttpResources.get();
assertThat(this.resourceFactory.getConnectionProvider()).isSameAs(globalResources);
assertThat(this.resourceFactory.getLoopResources()).isSameAs(globalResources);
assertThat(globalResources.isDisposed()).isFalse();
this.resourceFactory.destroy();
assertThat(globalResources.isDisposed()).isTrue();
}
use of reactor.netty.http.HttpResources in project spring-framework by spring-projects.
the class ReactorResourceFactory method afterPropertiesSet.
@Override
public void afterPropertiesSet() {
if (this.useGlobalResources) {
Assert.isTrue(this.loopResources == null && this.connectionProvider == null, "'useGlobalResources' is mutually exclusive with explicitly configured resources");
HttpResources httpResources = HttpResources.get();
if (this.globalResourcesConsumer != null) {
this.globalResourcesConsumer.accept(httpResources);
}
this.connectionProvider = httpResources;
this.loopResources = httpResources;
} else {
if (this.loopResources == null) {
this.manageLoopResources = true;
this.loopResources = this.loopResourcesSupplier.get();
}
if (this.connectionProvider == null) {
this.manageConnectionProvider = true;
this.connectionProvider = this.connectionProviderSupplier.get();
}
}
}
Aggregations