Прежде всего, это не функция Spring Integration, а Spring Framework Core.
Вот документы по этому вопросу: https://docs.spring.io/spring/docs/5.2.3.RELEASE/spring-framework-reference/integration.html#scheduling
Относительно что pool-size
, см. его описание:
The size of the executor's thread pool as either a single value or a range
(e.g. 5-10). If no bounded queue-capacity value is provided, then a max value
has no effect unless the range is specified as 0-n. In that case, the core pool
will have a size of n, but the 'allowCoreThreadTimeout' flag will be set to true.
If a queue-capacity is provided, then the lower bound of a range will map to the
core size and the upper bound will map to the max size. If this attribute is not
provided, the default core size will be 1, and the default max size will be
Integer.MAX_VALUE (i.e. unbounded).
Это <task:executor>
поддерживается ThreadPoolTaskExecutor
. Вот его JavaDocs:
* JavaBean that allows for configuring a {@link java.util.concurrent.ThreadPoolExecutor}
* in bean style (through its "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity"
* properties) and exposing it as a Spring {@link org.springframework.core.task.TaskExecutor}.
* This class is also well suited for management and monitoring (e.g. through JMX),
* providing several useful attributes: "corePoolSize", "maxPoolSize", "keepAliveSeconds"
* (all supporting updates at runtime); "poolSize", "activeCount" (for introspection only).
Я не уверен, что заставило вас думать, что поведение потоков связано с "запросом". Фактически это глобальный синглтон-бин с конфигурацией потоков 4
, и каждый, кто хотел бы выполнить задачу на этом исполнителе, должен делиться потоками со всеми остальными. Таким образом, независимо от количества ваших запросов, здесь будут работать только 4 потока. Все остальное ждет во внутренней очереди.