fix: Thread local storage test change (#2884)

* Updated the imports in code of the single table inheritance pattern for Spring Boot 3.x

#2825
Change javax library to jakarta

* add pom.xml

* Updated the imports in code of the healthcheck pattern for SpringBoot 3.x

Change javax library to jakarta and update maven dependency versions

* change order of imports to pass Checkstyle violations

* change import order to pass lexicographical order test

* change import order to pass CustomImportOrder warning

* Updated the maven imports of layers pattern for SpringBoot 3.2.4

* remove unused maven import

* Updated the maven imports of api-gateway pattern for SpringBoot 3.2.4

#2822

* Flaky test in Thread Local Storage #2880

* Rollback testing changes

* Flaky test in Thread Local Storage #2880

Create independent threadLocal to make values unsharable and unchangable by other thread

* rollback branch conflict
This commit is contained in:
Jun Kang
2024-04-01 23:54:49 +09:00
committed by GitHub
parent 9258cc854b
commit 74cce87c70
@@ -57,15 +57,15 @@ public class ThreadLocalTest {
int threadSize = 2;
ExecutorService executor = Executors.newFixedThreadPool(threadSize);
WithoutThreadLocal threadLocal = new WithoutThreadLocal(initialValue);
for (int i = 0; i < threadSize; i++) {
executor.submit(threadLocal);
//Create independent thread
WithoutThreadLocal threadLocal = new WithoutThreadLocal(initialValue);
executor.submit(threadLocal);
}
executor.awaitTermination(3, TimeUnit.SECONDS);
List<String> lines = outContent.toString().lines().toList();
//Matches only first thread, the second has changed by first thread value
Assertions.assertFalse(lines.stream()
Assertions.assertTrue(lines.stream()
.allMatch(line -> line.endsWith(String.valueOf(initialValue))));
}