mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -16,9 +16,13 @@ import org.dromara.hutool.core.exception.HutoolException;
|
||||
import org.dromara.hutool.core.thread.ThreadUtil;
|
||||
import lombok.Data;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SingletonTest {
|
||||
|
||||
@@ -65,4 +69,21 @@ public class SingletonTest {
|
||||
static class C{
|
||||
private B b = Singleton.get(B.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
void issue3435Test() {
|
||||
final String key = "123";
|
||||
final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
|
||||
for (int i = 0; i < 100; i++) {
|
||||
threadPoolExecutor.execute(() -> {
|
||||
Singleton.get(key, () -> {
|
||||
System.out.println(key);
|
||||
return "123";
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ThreadUtil.sleep(5000);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user