Example usage for org.springframework.data.gemfire GemfireCacheUtils convertGemfireAccessException

List of usage examples for org.springframework.data.gemfire GemfireCacheUtils convertGemfireAccessException

Introduction

In this page you can find the example usage for org.springframework.data.gemfire GemfireCacheUtils convertGemfireAccessException.

Prototype

public static DataAccessException convertGemfireAccessException(QueryInvalidException cause) 

Source Link

Document

Converts the given (unchecked) Gemfire exception to an appropriate one from the org.springframework.dao hierarchy.

Usage

From source file:org.spring.data.gemfire.app.dao.GemfireRegionCustomerDao.java

public Customer save(Customer customer) {
    try {//from   ww w  .  ja v a2 s .  c  om
        if (customer.isNew()) {
            customer.setId(ID_SEQUENCE.incrementAndGet());
            customersRegion().putIfAbsent(customer.getId(), customer);
        } else {
            customersRegion().put(customer.getId(), customer);
        }

        return customer;
    } catch (CacheWriterException e) {
        throw new DataAccessResourceFailureException("write-through failed", e);
    } catch (LeaseExpiredException e) {
        throw new PessimisticLockingFailureException("global lock lease expired", e);
    } catch (LowMemoryException e) {
        throw new DataAccessResourceFailureException("low memory", e);
    } catch (PartitionedRegionStorageException e) {
        throw new DataAccessResourceFailureException("PR op failure", e);
    } catch (TimeoutException e) {
        throw new DeadlockLoserDataAccessException("global lock acquisition timeout", e);
    } catch (GemFireException e) {
        throw GemfireCacheUtils.convertGemfireAccessException(e);
    }
}

From source file:org.springframework.data.gemfire.CacheFactoryBean.java

public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
    if (ex instanceof GemFireException) {
        return GemfireCacheUtils.convertGemfireAccessException((GemFireException) ex);
    }/*from w  w  w  . j  av  a  2  s  . c o m*/
    if (ex instanceof IllegalArgumentException) {
        DataAccessException wrapped = GemfireCacheUtils.convertQueryExceptions(ex);
        // ignore conversion if the generic exception is returned
        if (!(wrapped instanceof GemfireSystemException)) {
            return wrapped;
        }
    }

    return null;
}

From source file:org.springframework.data.gemfire.GemfireAccessor.java

/**
 * Converts the given {@link GemFireCheckedException} to an appropriate exception from the
 * <code>org.springframework.dao</code> hierarchy.
 * May be overridden in subclasses./*from  w w w .j ava2s  .c om*/
 * @param ex GemFireCheckedException that occurred
 * @return the corresponding DataAccessException instance
 */
public DataAccessException convertGemFireAccessException(GemFireCheckedException ex) {
    return GemfireCacheUtils.convertGemfireAccessException(ex);
}

From source file:org.springframework.data.gemfire.GemfireAccessor.java

/**
 * Converts the given {@link GemFireException} to an appropriate exception from the
 * <code>org.springframework.dao</code> hierarchy.
 * May be overridden in subclasses.//from   w ww  .ja v  a2s  . c  om
 * @param ex GemFireException that occurred
 * @return the corresponding DataAccessException instance
 */
public DataAccessException convertGemFireAccessException(GemFireException ex) {
    return GemfireCacheUtils.convertGemfireAccessException(ex);
}