mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
change link
This commit is contained in:
@@ -4,15 +4,16 @@ import cn.hutool.cache.impl.LRUCache;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* 见:https://github.com/dromara/hutool/issues/1895<br>
|
||||
* 见:https://github.com/chinabugotech/hutool/issues/1895<br>
|
||||
* 并发问题测试,在5.7.15前,LRUCache存在并发问题,多线程get后,map结构变更,导致null的位置不确定,
|
||||
* 并可能引起死锁。
|
||||
*/
|
||||
@@ -21,7 +22,7 @@ public class LRUCacheTest {
|
||||
@Test
|
||||
@Disabled
|
||||
public void putTest(){
|
||||
//https://github.com/dromara/hutool/issues/2227
|
||||
//https://github.com/chinabugotech/hutool/issues/2227
|
||||
final LRUCache<String, String> cache = CacheUtil.newLRUCache(100, 10);
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
//ThreadUtil.execute(()-> cache.put(RandomUtil.randomString(5), "1243", 10));
|
||||
|
@@ -2,10 +2,11 @@ package cn.hutool.cache;
|
||||
|
||||
import cn.hutool.cache.impl.WeakCache;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class WeakCacheTest {
|
||||
|
||||
@Test
|
||||
@@ -25,7 +26,7 @@ public class WeakCacheTest {
|
||||
@Test
|
||||
@Disabled
|
||||
public void removeByGcTest(){
|
||||
// https://gitee.com/dromara/hutool/issues/I51O7M
|
||||
// https://gitee.com/chinabugotech/hutool/issues/I51O7M
|
||||
WeakCache<String, String> cache = new WeakCache<>(-1);
|
||||
cache.put("a", "1");
|
||||
cache.put("b", "2");
|
||||
|
Reference in New Issue
Block a user