软锁定缓存条目已被底层 Ehcache 过期

发布于 2024-11-01 17:56:47 字数 644 浏览 1 评论 0原文

Hibernate 3.3.x、ehcache 2.2.x

<块引用>

当我尝试一次发布大量用户时,出现以下错误。知道为什么会发生这种情况以及如何纠正这个问题吗?有没有办法在批量加载用户之前禁用此缓存,如果可以,我应该怎么做?

17:17:50,140 WARN [AbstractReadWriteEhcacheAccessStrategy] Cache
persistence.unit:unitName=my.ear/my-ejb-1.0.0.jar#my.com.mycompany.User.phones Key com.mycompany.User.phones#9915 Lockable : null

A soft-locked cache entry was expired by the underlying Ehcache.
If this happens regularly you should consider increasing the cache timeouts and/or capacity limits

EDIT1:

当我尝试通过 JPA 调用将大量用户批量加载到数据库中时,会发生此错误。我不会通过拆卸挂钩关闭缓存管理器。

Hibernate 3.3.x, ehcache 2.2.x

The following error occurs, when I try to publish a lots of users in a single go. Any idea on why this would happen and how to rectify this? Is there a way to disable this cache prior to bulk loading of users, if so how should I do that?

17:17:50,140 WARN [AbstractReadWriteEhcacheAccessStrategy] Cache
persistence.unit:unitName=my.ear/my-ejb-1.0.0.jar#my.com.mycompany.User.phones Key com.mycompany.User.phones#9915 Lockable : null

A soft-locked cache entry was expired by the underlying Ehcache.
If this happens regularly you should consider increasing the cache timeouts and/or capacity limits

EDIT1:

This error happens when I try to bulk load a lot of users into the database via JPA calls. I don't shutdown the cache manager via a tear down hook.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼前雾蒙蒙 2024-11-08 17:56:47

从描述来看,实体的二级缓存似乎已满,并且其中一些实体被过早地从底层 ehcache 中逐出。你冲水 &在批量插入期间定期清除休眠会话,如文档

From the description it looks like the second-level cache for your entities are getting full, and some of them are getting evicted from the underlying ehcache prematurely. Do you flush & clear the hibernate Session periodically during your bulk-insert, as mentioned in the documentation?

回首观望 2024-11-08 17:56:47

You may also want to look at using a Stateless Session. If not, as @Binil Thomas mentioned, you're going to have to flush and clear your session to free up resources.

太阳哥哥 2024-11-08 17:56:47

将 maxElementsInMemory 增加到 0。有关更多参考

Increase maxElementsInMemory to 0. For more reference see this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文