【问题标题】:A soft-locked cache entry was expired by the underlying Ehcache软锁定缓存条目已被底层 Ehcache 过期
【发布时间】:2011-08-06 07:14:54
【问题描述】:

休眠 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

编辑1:

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

【问题讨论】:

    标签: hibernate caching jpa ehcache second-level-cache


    【解决方案1】:

    根据描述,您的实体的二级缓存似乎已满,其中一些实体已过早地从底层 ehcache 中逐出。如documentation 中所述,您是否在批量插入期间定期flushclear 休眠Session

    【讨论】:

    • 要验证假设,您可以尝试将 EhCache 的 maxElementsInMemory 设置为 0 - 这样就不会驱逐任何条目 - 并检查警告是否消失。
    【解决方案2】:

    您可能还想看看使用Stateless Session。如果没有,正如@Binil Thomas 所提到的,您将不得不flushclear 您的会话来释放资源。

    【讨论】:

      【解决方案3】:

      将 maxElementsInMemory 增加到 0。更多参考 see this

      【讨论】:

      • "增加到 0" 没有任何意义
      猜你喜欢
      • 2011-06-02
      • 1970-01-01
      • 2017-03-16
      • 2013-09-16
      • 1970-01-01
      • 1970-01-01
      • 2013-04-23
      • 2018-10-26
      • 2012-08-15
      相关资源
      最近更新 更多