Package net.sf.ehcache

Examples of net.sf.ehcache.CacheException


     * This method is not appropriate to use with BlockingCache.
     *
     * @throws CacheException if this method is called
     */
    public Map getAllWithLoader(Collection keys, Object loaderArgument) throws CacheException {
        throw new CacheException("This method is not appropriate for a Blocking Cache");
    }
View Full Code Here


     * This method is not appropriate to use with BlockingCache.
     *
     * @throws CacheException if this method is called
     */
    public void load(Object key) throws CacheException {
        throw new CacheException("This method is not appropriate for a Blocking Cache");
    }
View Full Code Here

     * This method is not appropriate to use with BlockingCache.
     *
     * @throws CacheException if this method is called
     */
    public void loadAll(Collection keys, Object argument) throws CacheException {
        throw new CacheException("This method is not appropriate for a Blocking Cache");
    }
View Full Code Here

    /**
     * This method should not be used. Because elements are always updated before they are
     * returned, it makes no sense to refresh this cache.
     */
    public void refresh() throws CacheException {
        throw new CacheException("UpdatingSelfPopulatingCache objects should not be refreshed.");
    }
View Full Code Here

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

    public 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

            System.out.println(toString() + " - disposed");
        }

        public void write(final Element element) throws CacheException {
            if (element == null) {
                throw new CacheException("No element to write");
            }

            System.out.println(toString() + " write[" + element.getObjectKey() + "]=" + element.getObjectValue());
        }
View Full Code Here

            }
        }

        public void delete(final CacheEntry entry) throws CacheException {
            if (entry == null) {
                throw new CacheException("No entry to delete");
            }
            System.out.println(toString() + " - delete[" + entry.getKey() + "]");
        }
View Full Code Here

                manager = new CacheManager(url);
            }
        } catch (net.sf.ehcache.CacheException e) {
            if (e.getMessage().startsWith("Cannot parseConfiguration CacheManager. Attempt to create a new instance of " +
                    "CacheManager using the diskStorePath")) {
                throw new CacheException("Could not init EhCacheFactory.", e);
            } else {
                throw e;
            }
        } finally {
            initializing = false;
View Full Code Here

        throw new UnsupportedOperationException("Use createCache(String name) instead.");
    }

    public synchronized EhcacheWrapper createCache(String name) {
        if (manager == null) {
            throw new CacheException("CacheFactory was not initialized. Call init() before creating a cache.");
        }
        try {
            Cache cache = manager.getCache(name);
            if (cache == null) {
                log.warning("Could not find a specific ehcache configuration for cache named [" + name + "]; using defaults.");
                manager.addCache(name);
                cache = manager.getCache(name);
            }
            Ehcache backingCache = cache;
            if (!backingCache.getCacheEventNotificationService().hasCacheEventListeners()) {
                if (listeners.size() > 0) {
                    for (CacheEventListener listener : listeners) {
                        if (!backingCache.getCacheEventNotificationService().getCacheEventListeners().contains(listener)) {
                            backingCache.getCacheEventNotificationService().registerListener(listener);
                        } else {
                        }
                    }
                }
            }
            return new EhcacheWrapper(cache);
        } catch (net.sf.ehcache.CacheException e) {
            throw new CacheException("Could not create cache: " + name, e);
        }
    }
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.