Fix phase for TaskScheduler instances in tests
Related to: #8856 Many tests create their own `ThreadPoolTaskScheduler` beans. Therefore, its default phase might affect the memory and performance. * Use `phase = SmartLifecycle.DEFAULT_PHASE / 2` for manual `ThreadPoolTaskScheduler` beans * Migrate affected tests classes to JUnit 5 * Make some other configuration adjustments for better performance **Cherry-pick to `6.2.x`**
This commit is contained in:
@@ -1,52 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/task https://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<import resource="common-context.xml" />
|
||||
<import resource="common-context.xml"/>
|
||||
|
||||
<int:channel id="input">
|
||||
<int:queue />
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int:bridge input-channel="input" output-channel="input2">
|
||||
<int:poller fixed-delay="200" />
|
||||
<int:poller fixed-delay="200"/>
|
||||
</int:bridge>
|
||||
|
||||
|
||||
<int:channel id="input2">
|
||||
<int:queue />
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int:inbound-channel-adapter id="explicit" ref="service" method="execute" channel="input">
|
||||
<int:poller fixed-rate="200" />
|
||||
<int:poller fixed-rate="200"/>
|
||||
</int:inbound-channel-adapter>
|
||||
|
||||
<bean id="service" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$SimpleService" />
|
||||
<bean id="service" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$SimpleService"/>
|
||||
|
||||
<bean id="activeChannel" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$ActiveChannelImpl" />
|
||||
<bean id="activeChannel"
|
||||
class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$ActiveChannelImpl"/>
|
||||
|
||||
<task:scheduler id="someScheduler" />
|
||||
|
||||
<task:executor id="someExecutor" />
|
||||
|
||||
<bean id="nonSpringExecutor" class="java.util.concurrent.Executors" factory-method="newSingleThreadExecutor" />
|
||||
|
||||
<bean id="otherActiveComponent" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$OtherActiveComponent">
|
||||
<property name="outputChannel" ref="input" />
|
||||
<bean id="someScheduler"
|
||||
class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
|
||||
<property name="phase" value="1073741823"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messageProducer" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$AMessageProducer">
|
||||
<property name="outputChannel" ref="input" />
|
||||
<task:executor id="someExecutor"/>
|
||||
|
||||
<bean id="nonSpringExecutor" class="java.util.concurrent.Executors" factory-method="newSingleThreadExecutor"/>
|
||||
|
||||
<bean id="otherActiveComponent"
|
||||
class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$OtherActiveComponent">
|
||||
<property name="outputChannel" ref="input"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messageProducer"
|
||||
class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$AMessageProducer">
|
||||
<property name="outputChannel" ref="input"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ignoreWrappedExecutor" class="org.springframework.core.task.support.ExecutorServiceAdapter">
|
||||
<constructor-arg ref="someExecutor" />
|
||||
<constructor-arg ref="someExecutor"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
|
||||
<bean id="activeChannel" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$ActiveChannelImpl" />
|
||||
|
||||
<task:scheduler id="someScheduler" />
|
||||
<bean id="someScheduler"
|
||||
class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
|
||||
<property name="phase" value="1073741823"/>
|
||||
</bean>
|
||||
|
||||
<task:executor id="someExecutor" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user