mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 04:35:14 +08:00
fix test
This commit is contained in:
parent
ac5abab4ea
commit
e7546e6c34
@ -21,6 +21,7 @@ import cn.hutool.v7.core.collection.iter.ArrayIter;
|
||||
import cn.hutool.v7.core.exception.CloneException;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
@ -37,6 +38,7 @@ import java.util.stream.StreamSupport;
|
||||
* @author Looly
|
||||
*/
|
||||
public class Tuple implements Iterable<Object>, Serializable, Cloneable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -7689304393482182157L;
|
||||
|
||||
/**
|
||||
@ -50,8 +52,17 @@ public class Tuple implements Iterable<Object>, Serializable, Cloneable {
|
||||
return new Tuple(members);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成员
|
||||
*/
|
||||
private final Object[] members;
|
||||
/**
|
||||
* hash值缓存
|
||||
*/
|
||||
private int hashCode;
|
||||
/**
|
||||
* 是否缓存hash值,当为true时,此对象的hash值只被计算一次,常用于Tuple中的值不变时使用。
|
||||
*/
|
||||
private boolean cacheHash;
|
||||
|
||||
/**
|
||||
|
@ -43,6 +43,7 @@ public class ThreadUtilTest {
|
||||
}
|
||||
}
|
||||
@Test
|
||||
@Disabled
|
||||
public void testNewExecutorByBlockingCoefficient(){
|
||||
final ThreadPoolExecutor executor = ThreadUtil.newExecutorByBlockingCoefficient(0.5f);
|
||||
Console.log(executor.getCorePoolSize());
|
||||
@ -92,13 +93,14 @@ public class ThreadUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void cyclicBarrierTest(){
|
||||
//示例:7个同学,集齐7个龙珠,7个同学一起召唤神龙;前后集齐了2次
|
||||
final AtomicInteger times = new AtomicInteger();
|
||||
final CyclicBarrier barrier = new CyclicBarrier(7, ()->{
|
||||
System.out.println(" ");
|
||||
System.out.println(" ");
|
||||
System.out.println("【循环栅栏业务处理】7个子线程 都收集了一颗龙珠,七颗龙珠已经收集齐全,开始召唤神龙。" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
Console.log(" ");
|
||||
Console.log(" ");
|
||||
Console.log("【循环栅栏业务处理】7个子线程 都收集了一颗龙珠,七颗龙珠已经收集齐全,开始召唤神龙。" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
times.getAndIncrement();
|
||||
}); // 现在设置的栅栏的数量为2
|
||||
for (int x = 0; x < 7; x++) { // 创建7个线程, 当然也可以使用线程池替换。
|
||||
|
Loading…
Reference in New Issue
Block a user