gpt4 book ai didi

java ConcurrentMap 获取空值

转载 作者:行者123 更新时间:2023-11-30 10:37:02 25 4
gpt4 key购买 nike

我有这个 ConcurrentMap

 ConcurrentMap<String, Byte[]> companyLogo = new MapMaker()
.concurrencyLevel(Runtime.getRuntime().availableProcessors())
.weakKeys()
.initialCapacity(1000)
.expiration(24, TimeUnit.HOURS)
.makeMap();

还有这段代码

companyLogo.put("cpr48124", ArrayUtils.toObject(resize (request, ((Byte[])request.getSession().getAttribute(COMPANY_LOGO_KEY+ imageId)))));
companyLogo.get("cpr48124");

但是 companyLogo.get("cpr48124"); 为空。怎么可能?

最佳答案

我不熟悉 MapMaker,但我猜 weakKeys 可能是您的问题。

很可能是您的新条目的“弱点”使其不可用,因为没有其他引用。

关于java ConcurrentMap 获取空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40285480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com