Search in sources :

Example 1 with LeaseExpiredException

use of org.apache.geode.distributed.LeaseExpiredException in project geode by apache.

the class AbstractBaseController method getValue.

protected <T> T getValue(final String regionNamePath, final Object key, boolean postProcess) {
    Assert.notNull(key, "The Cache Region key to read the value for cannot be null!");
    Region r = getRegion(regionNamePath);
    try {
        Object value = r.get(key);
        if (postProcess) {
            return (T) securityService.postProcess(regionNamePath, key, value, false);
        } else {
            return (T) value;
        }
    } catch (SerializationException se) {
        throw new DataTypeNotSupportedException("The resource identified could not convert into the supported content characteristics (JSON)!", se);
    } catch (NullPointerException npe) {
        throw new GemfireRestException(String.format("Resource (%1$s) configuration does not allow null keys!", regionNamePath), npe);
    } catch (IllegalArgumentException iae) {
        throw new GemfireRestException(String.format("Resource (%1$s) configuration does not allow requested operation on specified key!", regionNamePath), iae);
    } catch (LeaseExpiredException lee) {
        throw new GemfireRestException("Server has encountered error while processing this request!", lee);
    } catch (TimeoutException te) {
        throw new GemfireRestException("Server has encountered timeout error while processing this request!", te);
    } catch (CacheLoaderException cle) {
        throw new GemfireRestException("Server has encountered CacheLoader error while processing this request!", cle);
    } catch (PartitionedRegionStorageException prse) {
        throw new GemfireRestException("CacheLoader could not be invoked on partitioned region!", prse);
    }
}
Also used : GemfireRestException(org.apache.geode.rest.internal.web.exception.GemfireRestException) SerializationException(org.apache.geode.SerializationException) LeaseExpiredException(org.apache.geode.distributed.LeaseExpiredException) DataTypeNotSupportedException(org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException) PartitionedRegionStorageException(org.apache.geode.cache.PartitionedRegionStorageException) CacheLoaderException(org.apache.geode.cache.CacheLoaderException) Region(org.apache.geode.cache.Region) JSONObject(org.json.JSONObject) TimeoutException(org.apache.geode.cache.TimeoutException)

Aggregations

SerializationException (org.apache.geode.SerializationException)1 CacheLoaderException (org.apache.geode.cache.CacheLoaderException)1 PartitionedRegionStorageException (org.apache.geode.cache.PartitionedRegionStorageException)1 Region (org.apache.geode.cache.Region)1 TimeoutException (org.apache.geode.cache.TimeoutException)1 LeaseExpiredException (org.apache.geode.distributed.LeaseExpiredException)1 DataTypeNotSupportedException (org.apache.geode.rest.internal.web.exception.DataTypeNotSupportedException)1 GemfireRestException (org.apache.geode.rest.internal.web.exception.GemfireRestException)1 JSONObject (org.json.JSONObject)1