|
|
@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.common.threadutils; |
|
|
|
import org.apache.dolphinscheduler.common.thread.Stopper; |
|
|
|
import org.apache.dolphinscheduler.common.thread.Stopper; |
|
|
|
import org.apache.dolphinscheduler.common.thread.ThreadPoolExecutors; |
|
|
|
import org.apache.dolphinscheduler.common.thread.ThreadPoolExecutors; |
|
|
|
import org.apache.dolphinscheduler.common.thread.ThreadUtils; |
|
|
|
import org.apache.dolphinscheduler.common.thread.ThreadUtils; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
@ -31,6 +32,7 @@ import static org.junit.Assert.*; |
|
|
|
|
|
|
|
|
|
|
|
public class ThreadUtilsTest { |
|
|
|
public class ThreadUtilsTest { |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ThreadUtilsTest.class); |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ThreadUtilsTest.class); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* create a naming thread |
|
|
|
* create a naming thread |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -102,7 +104,6 @@ public class ThreadUtilsTest { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* test threadPoolExecutors with 3 workers and current each 5 tasks |
|
|
|
* test threadPoolExecutors with 3 workers and current each 5 tasks |
|
|
|
* @throws InterruptedException |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testThreadInfo() throws InterruptedException { |
|
|
|
public void testThreadInfo() throws InterruptedException { |
|
|
@ -114,7 +115,6 @@ public class ThreadUtilsTest { |
|
|
|
try { |
|
|
|
try { |
|
|
|
Thread.sleep(100); |
|
|
|
Thread.sleep(100); |
|
|
|
logger.info("worker %s is doing the task", index); |
|
|
|
logger.info("worker %s is doing the task", index); |
|
|
|
// workers.printStatus();
|
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException e) { |
|
|
|
logger.error("InterruptedException", e); |
|
|
|
logger.error("InterruptedException", e); |
|
|
|
} |
|
|
|
} |
|
|
@ -172,5 +172,4 @@ public class ThreadUtilsTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|