增加一个restClientBuilderCustomizer的bean
@Bean
public RestClientBuilderCustomizer autoRecreateRestClientBuilder() {
return new RestClientBuilderCustomizer() {
@Override
public void customize(HttpAsyncClientBuilder httpClientBuilder) {
try {
DefaultConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Override
public boolean handle(IOException e) {
log.error("esRestClient ioException", e);
return false;
}
@Override
public boolean handle(RuntimeException e) {
log.error("esRestClient runtimeException", e);
return false;
}
});
httpClientBuilder.setConnectionManager(
new PoolingNHttpClientConnectionManager(ioReactor));
} catch (IOReactorException e) {
throw new RuntimeException(e);
}
}
@Override
public void customize(RestClientBuilder restClientBuilder) {
}
};
}
参考文章来源:https://www.toymoban.com/news/detail-738956.html
https://www.shuzhiduo.com/A/kPzONDQadx/文章来源地址https://www.toymoban.com/news/detail-738956.html
到了这里,关于ES 查询报错 I/O 异常解决方法: Request cannot be executed; I/O reactor status: STOPPED的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!