欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

oscache在压力测试时的异常

程序员文章站 2022-04-14 09:15:43
...
java.lang.IllegalStateException: Cannot complete cache update - current state (1) is not UPDATE_IN_PROGRESS
at com.opensymphony.oscache.base.EntryUpdateState.completeUpdate(EntryUpdateState.java:105)
at com.opensymphony.oscache.base.Cache.completeUpdate(Cache.java:797)
at com.opensymphony.oscache.base.Cache.putInCache(Cache.java:641)
at com.opensymphony.oscache.base.Cache.putInCache(Cache.java:614)
at com.opensymphony.oscache.general.GeneralCacheAdministrator.putInCache(GeneralCacheAdministrator.java:270)
at com.opensymphony.oscache.hibernate.OSCache.put(OSCache.java:54)


此异常常出现第一次缓存对象时
出现错误的代码如下
    /**
* Updates the state to <code>UPDATE_COMPLETE</code>. This should <em>only</em>
* be called by the thread that managed to get the update lock.
* @return the counter value after the operation completed
*/
public int completeUpdate() {
if (state != UPDATE_IN_PROGRESS) {
throw new IllegalStateException("Cannot complete cache update - current state (" + state + ") is not UPDATE_IN_PROGRESS");
}

state = UPDATE_COMPLETE;
return decrementUsageCounter();
}