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.

An executor is required to handle java.util.concurrent.Callable return values. To configure a task executor in the MVC config under “async support”, you can make use of the <mvc:async-support> configuration element in your Spring MVC configuration file. This element allows you to specify a custom task executor to use for processing async requests.

Here’s an example configuration that demonstrates how to configure a task executor:

    <mvc:async-support task-executor="customTaskExecutor"/>
  
    <bean id="customTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
      <property name="corePoolSize" value="10" />
      <property name="maxPoolSize" value="20" />
      <property name="threadNamePrefix" value="CustomTaskExecutor-" />
    </bean>
  

In this example, we define a custom task executor bean named “customTaskExecutor” of type ThreadPoolTaskExecutor. The corePoolSize property specifies the number of threads to keep in the pool, and the maxPoolSize property defines the maximum number of threads in the pool. The threadNamePrefix property sets a prefix for the thread names.

You can customize the task executor configuration according to your requirements, such as setting the queue capacity, keep-alive time, etc.

Once you have defined the custom task executor bean, you can reference it in the <mvc:async-support> configuration element by setting the “task-executor” attribute with the corresponding bean name.

By configuring a suitable task executor, you can ensure that your application performs well under load when handling async requests using Callable return values.

Read more

Leave a comment