public class ConcurrencyTester extends Object
ps:
//模拟1000个线程并发
ConcurrencyTester ct = new ConcurrencyTester(1000);
ct.test(() -> {
// 需要并发测试的业务代码
});
| Constructor and Description |
|---|
ConcurrencyTester(int threadSize)
构造
|
| Modifier and Type | Method and Description |
|---|---|
long |
getInterval()
获取执行时间
|
ConcurrencyTester |
test(Runnable runnable)
执行测试
|
public ConcurrencyTester(int threadSize)
threadSize - 线程数public ConcurrencyTester test(Runnable runnable)
runnable - 要测试的内容public long getInterval()
Copyright © 2021. All rights reserved.