0

I am running a Spring-Boot Service v2.3.5.RELEASE. Its an API that is very process intensive. It makes calls to JNI->C++. While making such an Execution I get the following warning:

An Executor is required to handle java.util.concurrent.Callable return values. Please, configure a TaskExecutor in the MVC config under "async support". The SimpleAsyncTaskExecutor currently in use is not suitable under load.!!

Can such a warning ultimately lead to the microservice crashing?
And how to deal with this Warning?

Arsenal
  • 11
  • 5

2 Answers2

0

Can such a warning ultimately lead to the microservice crashing?

"Under load", (rather) bet on it! ;) (Not the warning itself, but the fact complained)

And how to deal with this Warning?

When (we think) "load" is no issue, we can ignore the warning. But the solution is not expensive:

see: Asynchronous REST API generating warning

cite:

@Configuration
@EnableAsync
public class AsyncConfig  implements AsyncConfigurer {

  @Bean
  protected WebMvcConfigurer webMvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
            configurer.setTaskExecutor(getTaskExecutor());
        }
    };
  }

  @Bean
  protected ConcurrentTaskExecutor getTaskExecutor() {
    return new ConcurrentTaskExecutor(Executors.newFixedThreadPool(5));
  }
}

Alternativeley we can configure any (for the warning to vanish: a non-trivial) TaskExecutor implementation.

See also:

xerx593
  • 12,237
  • 5
  • 33
  • 64
0

I fixed this by using 2 @Configuration beans like this:

@Configuration
@EnableAsync
public class MyApplicationConfiguration {
}

and

@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
    @Override
    public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
        configurer.setTaskExecutor(asyncTaskExecutor());
    }

    @Bean
    public AsyncTaskExecutor asyncTaskExecutor() {
        return new ConcurrentTaskExecutor(Executors.newFixedThreadPool(5));
    }
}

Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211