|
7 | 7 | import java.util.function.Supplier;
|
8 | 8 | import org.testng.internal.IConfiguration;
|
9 | 9 | import org.testng.internal.ObjectBag;
|
10 |
| -import org.testng.internal.RuntimeBehavior; |
11 | 10 | import org.testng.internal.Utils;
|
12 | 11 | import org.testng.internal.thread.TestNGThreadFactory;
|
13 | 12 | import org.testng.internal.thread.graph.GraphOrchestrator;
|
@@ -47,32 +46,27 @@ public TestTaskExecutor(
|
47 | 46 | public void execute() {
|
48 | 47 | String name = "test-" + xmlTest.getName();
|
49 | 48 | int threadCount = Math.max(xmlTest.getThreadCount(), 1);
|
50 |
| - if (RuntimeBehavior.favourCustomThreadPoolExecutor()) { |
51 |
| - throw new UnsupportedOperationException("This is NO LONGER Supported in TestNG"); |
52 |
| - |
| 49 | + boolean reUse = xmlTest.getSuite().useGlobalThreadPool(); |
| 50 | + Supplier<Object> supplier = |
| 51 | + () -> |
| 52 | + configuration |
| 53 | + .getExecutorServiceFactory() |
| 54 | + .create( |
| 55 | + threadCount, |
| 56 | + threadCount, |
| 57 | + 0, |
| 58 | + TimeUnit.MILLISECONDS, |
| 59 | + queue, |
| 60 | + new TestNGThreadFactory(name)); |
| 61 | + if (reUse) { |
| 62 | + ObjectBag bag = ObjectBag.getInstance(xmlTest.getSuite()); |
| 63 | + service = (ExecutorService) bag.createIfRequired(ExecutorService.class, supplier); |
53 | 64 | } else {
|
54 |
| - boolean reUse = xmlTest.getSuite().useGlobalThreadPool(); |
55 |
| - Supplier<Object> supplier = |
56 |
| - () -> |
57 |
| - configuration |
58 |
| - .getExecutorServiceFactory() |
59 |
| - .create( |
60 |
| - threadCount, |
61 |
| - threadCount, |
62 |
| - 0, |
63 |
| - TimeUnit.MILLISECONDS, |
64 |
| - queue, |
65 |
| - new TestNGThreadFactory(name)); |
66 |
| - if (reUse) { |
67 |
| - ObjectBag bag = ObjectBag.getInstance(xmlTest.getSuite()); |
68 |
| - service = (ExecutorService) bag.createIfRequired(ExecutorService.class, supplier); |
69 |
| - } else { |
70 |
| - service = (ExecutorService) supplier.get(); |
71 |
| - } |
72 |
| - GraphOrchestrator<ITestNGMethod> executor = |
73 |
| - new GraphOrchestrator<>(service, factory, graph, comparator); |
74 |
| - executor.run(); |
| 65 | + service = (ExecutorService) supplier.get(); |
75 | 66 | }
|
| 67 | + GraphOrchestrator<ITestNGMethod> executor = |
| 68 | + new GraphOrchestrator<>(service, factory, graph, comparator); |
| 69 | + executor.run(); |
76 | 70 | }
|
77 | 71 |
|
78 | 72 | public void awaitCompletion() {
|
|
0 commit comments