org.hibernate.cache.CacheException Java Examples

The following examples show how to use org.hibernate.cache.CacheException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReadWriteJ2CacheEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
@Override
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version) throws CacheException {
    region().writeLock( key );
    try {
        final AbstractReadWriteJ2CacheAccessStrategy.Lockable item = (AbstractReadWriteJ2CacheAccessStrategy.Lockable) region().get( key );
        if ( item == null ) {
            region().put( key, new AbstractReadWriteJ2CacheAccessStrategy.Item( value, version, region().nextTimestamp() ) );
            return true;
        }
        else {
            return false;
        }
    }
    finally {
        region().writeUnlock( key );
    }
}
 
Example #2
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
    try {
        return actualStrategy.putFromLoad(key, value, txTimestamp, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #3
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void unlockRegion(SoftLock lock) throws CacheException {
    try {
        this.actualStrategy.unlockRegion(lock);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #4
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
    try {
        return this.actualStrategy.lockItem(session, key, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return null;
    }
}
 
Example #5
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public SoftLock lockItem(Object key, Object version) throws CacheException {
    try {
        return actualStrategy.lockItem(key, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return null;
    }
}
 
Example #6
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
        throws CacheException {
    try {
        return actualStrategy.putFromLoad(key, value, txTimestamp, version, minimalPutOverride);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #7
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
    try {
        return actualStrategy.putFromLoad(key, value, txTimestamp, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #8
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void remove(Object key) throws CacheException {
    try {
        actualStrategy.remove(key);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #9
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException {
    try {
        return this.actualStrategy.putFromLoad(session, key, value, txTimestamp, version, minimalPutOverride);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #10
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void evictAll() throws CacheException {
    try {
        this.actualStrategy.evictAll();
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #11
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void unlockRegion(SoftLock lock) throws CacheException {
    try {
        actualStrategy.unlockRegion(lock);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #12
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
    try {
        this.actualStrategy.unlockItem(session, key, lock);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #13
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void evict(Object key) throws CacheException {
    try {
        actualStrategy.evict(key);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #14
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void evictAll() throws CacheException {
    try {
        actualStrategy.evictAll();
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #15
Source File: NonstopAwareNaturalIdRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
    try {
        return this.actualStrategy.afterInsert(session, key, value);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #16
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean insert(Object key, Object value, Object version) throws CacheException {
    try {
        return actualStrategy.insert(key, value, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #17
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
    try {
        return actualStrategy.afterUpdate(key, value, currentVersion, previousVersion, lock);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #18
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void remove(Object key) throws CacheException {
    try {
        actualStrategy.remove(key);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #19
Source File: TransactionalJ2CacheNaturalIdRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException {
    if (minimalPutOverride && cache.get(key) != null) {
        return false;
    }
    cache.put(key, value);
    return true;
}
 
Example #20
Source File: J2CacheDataRegion.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
public void destroy() throws CacheException {
    try {
        getCache().clear();
    } catch (IllegalStateException e) {
        LOG.debug("This can happen if multiple frameworks both try to shutdown ehcache", e);
    }
}
 
Example #21
Source File: AbstractJ2CacheRegionFactory.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties, CacheDataDescription metadata)
        throws CacheException {
    return new J2CacheNaturalIdRegion(
            accessStrategyFactory,
            getCache( regionName ),
            settings,
            metadata,
            properties
    );
}
 
Example #22
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
    try {
        this.actualStrategy.unlockItem(session, key, lock);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #23
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version) throws CacheException {
    try {
        return this.actualStrategy.afterInsert(session, key, value, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #24
Source File: NonstopAwareNaturalIdRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public boolean update(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
    try {
        return this.actualStrategy.update(session, key, value);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return false;
    }
}
 
Example #25
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public SoftLock lockRegion() throws CacheException {
    try {
        return this.actualStrategy.lockRegion();
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return null;
    }
}
 
Example #26
Source File: J2CacheRegionFactory.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {
    this.settings = settings;
    if (this.channel == null) {
        this.channel = J2Cache.getChannel();
    }
}
 
Example #27
Source File: NonstopAwareNaturalIdRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public void evictAll() throws CacheException {
    try {
        this.actualStrategy.evictAll();
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
    }
}
 
Example #28
Source File: AbstractReadWriteJ2CacheAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
public final void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException {
    region().writeLock(key);
    try {
        final Lockable item = (Lockable) region().get(key);
        if ((item != null) && item.isUnlockable(lock)) {
            decrementLock(key, (Lock) item);
        } else {
            handleLockExpiry(key, item);
        }
    } finally {
        region().writeUnlock(key);
    }
}
 
Example #29
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public SoftLock lockRegion() throws CacheException {
    try {
        return this.actualStrategy.lockRegion();
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return null;
    }
}
 
Example #30
Source File: NonstopAwareNaturalIdRegionAccessStrategy.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) throws CacheException {
    try {
        return this.actualStrategy.lockItem(session, key, version);
    } catch (NonStopCacheException nonStopCacheException) {
        hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
        return null;
    }
}