软锁定缓存条目已被底层 Ehcache 过期
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从描述来看,实体的二级缓存似乎已满,并且其中一些实体被过早地从底层 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 hibernateSession
periodically during your bulk-insert, as mentioned in the documentation?您可能还想考虑使用 无状态会话。如果没有,正如@Binil Thomas提到的,您将不得不
刷新
并清除
您的会话以释放资源。You may also want to look at using a Stateless Session. If not, as @Binil Thomas mentioned, you're going to have to
flush
andclear
your session to free up resources.将 maxElementsInMemory 增加到 0。有关更多参考
Increase maxElementsInMemory to 0. For more reference see this