Package net.sf.ehcache

Examples of net.sf.ehcache.CacheException


    static CacheManager createCacheManager() throws CacheException {
        try {
            return (CacheManager)cacheManagerCreateMethodNoArg.invoke(null, (Object[])null);
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }
View Full Code Here


    static CacheManager createCacheManager(URL url) throws CacheException {
        try {
            return (CacheManager)createMethodURLArg.invoke(null, new Object[]{url});
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }
View Full Code Here

    static CacheManager createCacheManager(Configuration conf) throws CacheException {
        try {
            return (CacheManager)cacheManagerCreateMethodConfigurationArg.invoke(null, new Object[]{conf});
        } catch (Exception e) {
            throw new CacheException(e);
        }
    }   
View Full Code Here

        String key = exchange.getIn().getHeader(CacheConstants.CACHE_KEY, String.class);
        String operation = exchange.getIn().getHeader(CacheConstants.CACHE_OPERATION, String.class);

        if (operation == null) {
            throw new CacheException("Operation not specified in the message header [" + CacheConstants.CACHE_KEY + "]");
        }
        if ((key == null) && (!operation.equalsIgnoreCase(CacheConstants.CACHE_OPERATION_DELETEALL))) {
            throw new CacheException("Cache Key is not specified in message header header or endpoint URL.");
        }

        performCacheOperation(exchange, operation, key);
    }
View Full Code Here

                exchange.getIn().setHeader(CacheConstants.CACHE_ELEMENT_WAS_FOUND, true);
            } else {
                exchange.getIn().removeHeader(CacheConstants.CACHE_ELEMENT_WAS_FOUND);
            }
        } else {
            throw new CacheException("Operation " + operation + " is not supported.");
        }
    }
View Full Code Here

            exchange = cacheConsumer.getEndpoint().createCacheExchange(operation, (String) element.getObjectKey(), element.getObjectValue());
        }
        try {
            cacheConsumer.getProcessor().process(exchange);
        } catch (Exception e) {
            throw new CacheException("Error in consumer while dispatching exchange containing key "
                + (element != null ? element.getObjectKey() : null) + " for further processing", e);
        }
    }
View Full Code Here

        if (params.containsKey(de.innovationgate.utils.cache.Cache.PARAM_TIME_TO_LIVE_SECONDS)) {
            try {
                _timeToLive = ((Integer) params.get(de.innovationgate.utils.cache.Cache.PARAM_TIME_TO_LIVE_SECONDS)).intValue();
            }
            catch (ClassCastException e) {
                throw new CacheException("Invalid data type for timeToLive, must be Integer but is: " + params.get(de.innovationgate.utils.cache.Cache.PARAM_TIME_TO_LIVE_SECONDS).getClass().getName());
            }
        }
       
        try {
            _ehcache = new Cache(name, capacity, false, (_timeToLive > 0), _timeToLive, 0);
View Full Code Here

            else {
                return null;
            }
        }
        catch (Exception e) {
            throw new CacheException("Error reading item cache for key '" + key + "'", e);
        }
    }
View Full Code Here

                element.setTimeToLive(secondsToLive);
            }
            _ehcache.put(element);
        }
        catch (RuntimeException e) {
            throw new CacheException("Exception writing cache entry for key '" + key + "', group '" + group + "'",e);
        }


    }
View Full Code Here

      
       
        String key = (String) exchange.getIn().getHeader("CACHE_KEY");
        String operation = (String) exchange.getIn().getHeader("CACHE_OPERATION");
        if (operation == null) {
            throw new CacheException("Operation property is not specified in the incoming exchange header."
                + "A valid Operation property must be set to ADD, UPDATE, DELETE, DELETEALL");
        }
        if ((key == null) && (!operation.equalsIgnoreCase("DELETEALL"))) {
            throw new CacheException("Cache Key is not specified in exchange either header or URL. Unable to add objects to the cache without a Key");
        }
       
        performCacheOperation(exchange, operation, key);
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.CacheException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.