oscache在压力测试时的异常

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();
    }

你可能感兴趣的:(java,thread,Hibernate,cache)