You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/12/18 14:36:03 UTC
(commons-beanutils) branch master updated: Reuse BasicThreadFactory in test
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
The following commit(s) were added to refs/heads/master by this push:
new b56b4758 Reuse BasicThreadFactory in test
b56b4758 is described below
commit b56b4758675601fa4e4fbcdbf2ad6a6a7a77e32c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 18 09:35:58 2024 -0500
Reuse BasicThreadFactory in test
---
.../java/org/apache/commons/beanutils2/bugs/Jira509Test.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/test/java/org/apache/commons/beanutils2/bugs/Jira509Test.java b/src/test/java/org/apache/commons/beanutils2/bugs/Jira509Test.java
index a7bb7eb5..2ed601f0 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira509Test.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira509Test.java
@@ -32,6 +32,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.commons.beanutils2.WrapDynaClass;
+import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
@@ -54,15 +55,11 @@ public class Jira509Test {
*/
@Timeout(value = 60, unit = TimeUnit.SECONDS)
@Test
- public void test_concurrent() throws InterruptedException {
+ public void testConcurrent() throws InterruptedException {
final List<Class<?>> classList = Arrays.asList(Map.class, HashMap.class, Collections.class, Arrays.class, Collection.class, Set.class, ArrayList.class,
List.class, HashSet.class);
// All daemon threads.
- final ExecutorService executor = Executors.newFixedThreadPool(100, r -> {
- final Thread thread = new Thread(r);
- thread.setDaemon(true);
- return thread;
- });
+ final ExecutorService executor = Executors.newFixedThreadPool(100, new BasicThreadFactory.Builder().daemon(true).build());
try {
// Loop _may_ hang without fix.
for (int i = 1; i < 10_000_000; i++) {