Package org.castor.cache

Examples of org.castor.cache.CacheAcquireException


                    TYPES_GET_CACHE, new Object[] {getName()});

        } catch (Exception e) {
            String msg = "Error creating EHCache cache: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }

        Class < ? > cls = _cache.getClass();

        try {
            _elementClass = Class.forName("net.sf.ehcache.Element");
            _getValueMethod = _elementClass.getMethod("getValue", (Class[]) null);
            _isExpiredMethod = _elementClass.getMethod("isExpired", (Class[]) null);
        } catch (Exception e) {
            String msg =
                "Failed to instantiate Class for type 'net.sf.ehcache.Element': "
                + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }

        try {
            _getSizeMethod = cls.getMethod("getSize", (Class[]) null);
            _getMethod = cls.getMethod("get", TYPES_GET);
            _putMethod = cls.getMethod("put", new Class[] {_elementClass });
            _removeMethod = cls.getMethod("remove", TYPES_REMOVE);
            _removeAllMethod = cls.getMethod("removeAll", (Class[]) null);
            _elementConstructor =
                _elementClass.getConstructor(TYPES_ELEMENT_CONSTRUCTOR);
            _removeAllMethod = cls.getMethod("removeAll", (Class[]) null);
        } catch (Exception e) {
            String msg = "Failed to find method on EHCache instance: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
    }
View Full Code Here


            for (int i = 0; i < _poolCount; i++) {
                _pool[i] = cls.newInstance();
            }
        } catch (Exception ex) {
            String msg = "Failed to instantiate hashbelt container.";
            throw new CacheAcquireException(msg, ex);
        }

        try {
            Class < ? extends AbstractReaper > cls = DEFAULT_REAPER_CLASS;
            param = params.getProperty(PARAM_REAPER_CLASS);
            if ((param != null) && !"".equals(param)) {
                cls = (Class < ? extends AbstractReaper > ) Class.forName(param);
            }

            _reaper = cls.newInstance();
            _reaper.setCache(this);
        } catch (Exception ex) {
            String msg = "Failed to instantiate hashbelt reaper.";
            throw new CacheAcquireException(msg, ex);
        }

        try {
            param = params.getProperty(PARAM_CAPACITY);
            if (param != null) { _cacheCapacity = Integer.parseInt(param); }
View Full Code Here

            _removeMethod = cls.getMethod("flushEntry", TYPES_REMOVE);
            _clearMethod = cls.getMethod("flushGroup", TYPES_CLEAR);
        } catch (Exception e) {
            String msg = "Failed to find method on OSCache instance: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
       
        _groups = new String[] {getName()};
    }
View Full Code Here

            try {
                _cache = loader.loadClass(implementation).newInstance();
            } catch (ClassNotFoundException cnfe) {
                String msg = "Cannot find class " + implementation + ".";
                LOG.error(msg, cnfe);
                throw new CacheAcquireException(msg, cnfe);
            } catch (IllegalAccessException iae) {
                String msg = "Illegal access with class " + implementation + ".";
                LOG.error(msg, iae);
                throw new CacheAcquireException(msg, iae);
            } catch (InstantiationException ie) {
                String msg = "Cannot create instance of " + implementation + ".";
                LOG.error(msg, ie);
                throw new CacheAcquireException(msg, ie);
            }
        }
       
        Cache cache = null;
        try {
            Class < ? > cls = loader.loadClass(getCacheClassName());
            Constructor < ? > cst = cls.getConstructor(new Class[] {Object.class});
            cache = (Cache) cst.newInstance(new Object[] {_cache});
        } catch (ClassNotFoundException cnfe) {
            String msg = "Cannot find class " + getCacheClassName() + ".";
            LOG.error(msg, cnfe);
            throw new CacheAcquireException(msg, cnfe);
        } catch (NoSuchMethodException nsme) {
            String msg = "NoSuchMethodException";
            LOG.error(msg, nsme);
            throw new CacheAcquireException(msg, nsme);
        } catch (IllegalAccessException iae) {
            String msg = "Illegal access with class " + getCacheClassName() + ".";
            LOG.error(msg, iae);
            throw new CacheAcquireException(msg, iae);
        } catch (InstantiationException ie) {
            String msg = "Cannot create instance of " + getCacheClassName() + ".";
            LOG.error(msg, ie);
            throw new CacheAcquireException(msg, ie);
        } catch (InvocationTargetException ite) {
            String msg = "InvocationTargetException";
            LOG.error(msg, ite);
            throw new IllegalStateException(ite.getMessage());
        }
View Full Code Here

            setCache((Map) invokeMethod(factory, "getMapAccess",
                    TYPES_GET_MAP_ACCESS, new Object[] {getName()}));
        } catch (Exception e) {
            String msg = "Error creating JCache cache: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
    }
View Full Code Here

            setCache((Map) invokeStaticMethod(
                    cls, "getCache", TYPES_GET_CACHE, new Object[] {getName()}));
        } catch (Exception e) {
            String msg = "Error creating Coherence cache: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
    }
View Full Code Here

            _removeMethod = cls.getMethod("remove", TYPES_REMOVE);
            _clearMethod = cls.getMethod("clear", (Class[]) null);
        } catch (Exception e) {
            String msg = "Error creating JCS cache: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
    }
View Full Code Here

            Object factory = invokeStaticMethod(cls, "getInstance", null, null);
            setCache((Map) invokeMethod(factory, "getMapAccess", null, null));
        } catch (Exception e) {
            String msg = "Error creating FKCache cache: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
    }
View Full Code Here

                    cls, "find", TYPES_FIND_CACHE, new Object[] {clusterURL.toString()}));
        } catch (Exception e) {
            LOG.error("Problem!", e);
            String msg = "Error creating Gigaspaces cache: " + e.getMessage();
            LOG.error(msg, e);
            throw new CacheAcquireException(msg, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.castor.cache.CacheAcquireException

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.