/** * A simple factory method to hide the messiness of creating the proxy from clients. * * @param ehcache the target cache * @return a proxied Ehcache */ public static Ehcache createProxy(Ehcache ehcache) { return (Ehcache) Proxy.newProxyInstance(ehcache.getClass().getClassLoader(), new Class[]{Ehcache.class}, new ExceptionHandlingDynamicCacheProxy(ehcache)); }
keyAsString = extractKey(cause.getMessage()); cacheExceptionHandler.onException(ehcache, keyAsString, causeAsException); } else { throw e.getCause();
private Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { CacheExceptionHandler cacheExceptionHandler = createCacheExceptionHandler(cacheConfiguration.getCacheExceptionHandlerFactoryConfiguration(), loader); cache.setCacheExceptionHandler(cacheExceptionHandler); if (cache.getCacheExceptionHandler() != null) { return ExceptionHandlingDynamicCacheProxy.createProxy(cache); } return cache; }
/** * Tries to create a CacheLoader from the configuration using the factory * specified. * * @return The CacheExceptionHandler, or null if it could not be found. */ public static CacheExceptionHandler createCacheExceptionHandler( CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader) throws CacheException { String className = null; CacheExceptionHandler cacheExceptionHandler = null; if (factoryConfiguration != null) { className = factoryConfiguration.getFullyQualifiedClassPath(); } if (className == null || className.length() == 0) { LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); } else { CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) ClassLoaderUtil.createNewInstance(loader, className); Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), factoryConfiguration.getPropertySeparator()); return factory.createExceptionHandler(properties); } return cacheExceptionHandler; }
keyAsString = extractKey(cause.getMessage()); cacheExceptionHandler.onException(ehcache, keyAsString, causeAsException); } else { throw e.getCause();
private Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { CacheExceptionHandler cacheExceptionHandler = createCacheExceptionHandler(cacheConfiguration.getCacheExceptionHandlerFactoryConfiguration(), loader); cache.setCacheExceptionHandler(cacheExceptionHandler); if (cache.getCacheExceptionHandler() != null) { return ExceptionHandlingDynamicCacheProxy.createProxy(cache); } return cache; }
/** * Tries to create a CacheLoader from the configuration using the factory * specified. * * @return The CacheExceptionHandler, or null if it could not be found. */ public static CacheExceptionHandler createCacheExceptionHandler( CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration) throws CacheException { String className = null; CacheExceptionHandler cacheExceptionHandler = null; if (factoryConfiguration != null) { className = factoryConfiguration.getFullyQualifiedClassPath(); } if (className == null || className.length() == 0) { LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); } else { CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) ClassLoaderUtil.createNewInstance(className); Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), factoryConfiguration.getPropertySeparator()); return factory.createExceptionHandler(properties); } return cacheExceptionHandler; }
/** * A simple factory method to hide the messiness of creating the proxy from clients. * * @param ehcache the target cache * @return a proxied Ehcache */ public static Ehcache createProxy(Ehcache ehcache) { return (Ehcache) Proxy.newProxyInstance(ehcache.getClass().getClassLoader(), new Class[]{Ehcache.class}, new ExceptionHandlingDynamicCacheProxy(ehcache)); }
keyAsString = extractKey(cause.getMessage()); cacheExceptionHandler.onException(ehcache, keyAsString, causeAsException); } else { throw e.getCause();
private Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { CacheExceptionHandler cacheExceptionHandler = createCacheExceptionHandler(cacheConfiguration.getCacheExceptionHandlerFactoryConfiguration()); cache.setCacheExceptionHandler(cacheExceptionHandler); if (cache.getCacheExceptionHandler() != null) { return ExceptionHandlingDynamicCacheProxy.createProxy(cache); } return cache; }
/** * Tries to create a CacheLoader from the configuration using the factory * specified. * * @return The CacheExceptionHandler, or null if it could not be found. */ public final static CacheExceptionHandler createCacheExceptionHandler( CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration) throws CacheException { String className = null; CacheExceptionHandler cacheExceptionHandler = null; if (factoryConfiguration != null) { className = factoryConfiguration.getFullyQualifiedClassPath(); } if (className == null || className.length() == 0) { LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); } else { CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) ClassLoaderUtil .createNewInstance(className); Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), factoryConfiguration .getPropertySeparator()); return factory.createExceptionHandler(properties); } return cacheExceptionHandler; }
/** * A simple factory method to hide the messiness of creating the proxy from clients. * * @param ehcache the target cache * @return a proxied Ehcache */ public static Ehcache createProxy(Ehcache ehcache) { return (Ehcache) Proxy.newProxyInstance(ehcache.getClass().getClassLoader(), new Class[]{Ehcache.class}, new ExceptionHandlingDynamicCacheProxy(ehcache)); }
keyAsString = extractKey(cause.getMessage()); cacheExceptionHandler.onException(ehcache, keyAsString, causeAsException); } else { throw e.getCause();
private Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { CacheExceptionHandler cacheExceptionHandler = createCacheExceptionHandler(cacheConfiguration.getCacheExceptionHandlerFactoryConfiguration(), loader); cache.setCacheExceptionHandler(cacheExceptionHandler); if (cache.getCacheExceptionHandler() != null) { return ExceptionHandlingDynamicCacheProxy.createProxy(cache); } return cache; }
/** * Tries to create a CacheLoader from the configuration using the factory * specified. * * @return The CacheExceptionHandler, or null if it could not be found. */ public static CacheExceptionHandler createCacheExceptionHandler( CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader) throws CacheException { String className = null; CacheExceptionHandler cacheExceptionHandler = null; if (factoryConfiguration != null) { className = factoryConfiguration.getFullyQualifiedClassPath(); } if (className == null || className.length() == 0) { LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); } else { CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) ClassLoaderUtil.createNewInstance(loader, className); Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), factoryConfiguration.getPropertySeparator()); return factory.createExceptionHandler(properties); } return cacheExceptionHandler; }
/** * A simple factory method to hide the messiness of creating the proxy from clients. * * @param ehcache the target cache * @return a proxied Ehcache */ public static Ehcache createProxy(Ehcache ehcache) { return (Ehcache) Proxy.newProxyInstance(ehcache.getClass().getClassLoader(), new Class[]{Ehcache.class}, new ExceptionHandlingDynamicCacheProxy(ehcache)); }
private static Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { CacheExceptionHandler cacheExceptionHandler = createCacheExceptionHandler(cacheConfiguration .getCacheExceptionHandlerFactoryConfiguration()); cache.setCacheExceptionHandler(cacheExceptionHandler); if (cache.getCacheExceptionHandler() != null) { return ExceptionHandlingDynamicCacheProxy.createProxy(cache); } return cache; }
/** * Tries to create a CacheLoader from the configuration using the factory * specified. * * @return The CacheExceptionHandler, or null if it could not be found. */ public final static CacheExceptionHandler createCacheExceptionHandler( CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration) throws CacheException { String className = null; CacheExceptionHandler cacheExceptionHandler = null; if (factoryConfiguration != null) { className = factoryConfiguration.getFullyQualifiedClassPath(); } if (className == null || className.length() == 0) { LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); } else { CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) ClassLoaderUtil .createNewInstance(className); Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), factoryConfiguration .getPropertySeparator()); return factory.createExceptionHandler(properties); } return cacheExceptionHandler; }
private static Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { CacheExceptionHandler cacheExceptionHandler = createCacheExceptionHandler(cacheConfiguration .getCacheExceptionHandlerFactoryConfiguration()); cache.setCacheExceptionHandler(cacheExceptionHandler); if (cache.getCacheExceptionHandler() != null) { return ExceptionHandlingDynamicCacheProxy.createProxy(cache); } return cache; }
/** * Tries to create a CacheLoader from the configuration using the factory * specified. * * @return The CacheExceptionHandler, or null if it could not be found. */ public static CacheExceptionHandler createCacheExceptionHandler( CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader) throws CacheException { String className = null; CacheExceptionHandler cacheExceptionHandler = null; if (factoryConfiguration != null) { className = factoryConfiguration.getFullyQualifiedClassPath(); } if (className == null || className.length() == 0) { LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); } else { CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) ClassLoaderUtil.createNewInstance(loader, className); Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), factoryConfiguration.getPropertySeparator()); return factory.createExceptionHandler(properties); } return cacheExceptionHandler; }