Skip to content

Commit b56b475

Browse files
committed
Reuse BasicThreadFactory in test
1 parent a3d2ace commit b56b475

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/test/java/org/apache/commons/beanutils2/bugs/Jira509Test.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.concurrent.TimeUnit;
3333

3434
import org.apache.commons.beanutils2.WrapDynaClass;
35+
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
3536
import org.junit.jupiter.api.Disabled;
3637
import org.junit.jupiter.api.Test;
3738
import org.junit.jupiter.api.Timeout;
@@ -54,15 +55,11 @@ protected int random(final int max) {
5455
*/
5556
@Timeout(value = 60, unit = TimeUnit.SECONDS)
5657
@Test
57-
public void test_concurrent() throws InterruptedException {
58+
public void testConcurrent() throws InterruptedException {
5859
final List<Class<?>> classList = Arrays.asList(Map.class, HashMap.class, Collections.class, Arrays.class, Collection.class, Set.class, ArrayList.class,
5960
List.class, HashSet.class);
6061
// All daemon threads.
61-
final ExecutorService executor = Executors.newFixedThreadPool(100, r -> {
62-
final Thread thread = new Thread(r);
63-
thread.setDaemon(true);
64-
return thread;
65-
});
62+
final ExecutorService executor = Executors.newFixedThreadPool(100, new BasicThreadFactory.Builder().daemon(true).build());
6663
try {
6764
// Loop _may_ hang without fix.
6865
for (int i = 1; i < 10_000_000; i++) {

0 commit comments

Comments
 (0)