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:
Artem Bilan
2024-01-16 11:25:54 -05:00
parent ed9616a466
commit 39c99c0719
25 changed files with 249 additions and 205 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,6 +69,8 @@ public class StompServerIntegrationTests {
private static final EmbeddedActiveMQ broker = new EmbeddedActiveMQ();
private static final ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
private static ReactorNettyTcpStompClient stompClient;
@BeforeAll
@@ -89,7 +91,6 @@ public class StompServerIntegrationTests {
stompClient = new ReactorNettyTcpStompClient("127.0.0.1", TransportConstants.DEFAULT_STOMP_PORT);
stompClient.setMessageConverter(new PassThruMessageConverter());
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.afterPropertiesSet();
stompClient.setTaskScheduler(taskScheduler);
stompClient.setReceiptTimeLimit(5000);
@@ -99,6 +100,7 @@ public class StompServerIntegrationTests {
public static void teardown() throws Exception {
stompClient.shutdown();
broker.stop();
taskScheduler.destroy();
}
@Test