Search in sources :

Example 1 with NonStopCacheException

use of net.sf.ehcache.constructs.nonstop.NonStopCacheException in project hibernate-orm by hibernate.

the class EhcacheGeneralDataRegion method put.

@Override
public void put(SharedSessionContractImplementor session, Object key, Object value) throws CacheException {
    LOG.debugf("key: %s value: %s", key, value);
    try {
        final Element element = new Element(key, value);
        getCache().put(element);
    } catch (IllegalArgumentException e) {
        throw new CacheException(e);
    } catch (IllegalStateException e) {
        throw new CacheException(e);
    } catch (net.sf.ehcache.CacheException e) {
        if (e instanceof NonStopCacheException) {
            HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
        } else {
            throw new CacheException(e);
        }
    }
}
Also used : CacheException(org.hibernate.cache.CacheException) NonStopCacheException(net.sf.ehcache.constructs.nonstop.NonStopCacheException) Element(net.sf.ehcache.Element) NonStopCacheException(net.sf.ehcache.constructs.nonstop.NonStopCacheException)

Example 2 with NonStopCacheException

use of net.sf.ehcache.constructs.nonstop.NonStopCacheException in project hibernate-orm by hibernate.

the class EhcacheTransactionalDataRegion method put.

/**
	 * Map the given value to the given key, replacing any existing mapping for this key
	 *
	 * @param key The cache key
	 * @param value The data to cache
	 *
	 * @throws CacheException Indicates a problem accessing the cache
	 */
public final void put(Object key, Object value) throws CacheException {
    try {
        final Element element = new Element(key, value);
        getCache().put(element);
    } catch (IllegalArgumentException e) {
        throw new CacheException(e);
    } catch (IllegalStateException e) {
        throw new CacheException(e);
    } catch (net.sf.ehcache.CacheException e) {
        if (e instanceof NonStopCacheException) {
            HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
        } else {
            throw new CacheException(e);
        }
    }
}
Also used : NonStopCacheException(net.sf.ehcache.constructs.nonstop.NonStopCacheException) CacheException(org.hibernate.cache.CacheException) Element(net.sf.ehcache.Element) NonStopCacheException(net.sf.ehcache.constructs.nonstop.NonStopCacheException)

Aggregations

Element (net.sf.ehcache.Element)2 NonStopCacheException (net.sf.ehcache.constructs.nonstop.NonStopCacheException)2 CacheException (org.hibernate.cache.CacheException)2