List of usage examples for org.hibernate.cache CacheException CacheException
public CacheException(String message, Throwable cause)
From source file:com.googlecode.hibernate.memcached.MemcachedCacheProvider.java
License:Apache License
protected KeyStrategy instantiateKeyStrategy(String cls) { try {//from w w w . ja v a2 s.c o m return (KeyStrategy) Class.forName(cls).newInstance(); } catch (InstantiationException e) { throw new CacheException("Could not instantiate keyStrategy class", e); } catch (IllegalAccessException e) { throw new CacheException("Could not instantiate keyStrategy class", e); } catch (ClassNotFoundException e) { throw new CacheException("Could not instantiate keyStrategy class", e); } }
From source file:com.googlecode.hibernate.memcached.MemcachedCacheProvider.java
License:Apache License
public void start(Properties properties) throws CacheException { log.info("Starting MemcachedClient..."); try {// ww w.j av a 2 s . c o m client = getMemcachedClientFactory(new Config(new PropertiesHelper(properties))).createMemcacheClient(); } catch (Exception e) { throw new CacheException("Unable to initialize MemcachedClient", e); } }
From source file:com.googlecode.hibernate.memcached.MemcachedCacheProvider.java
License:Apache License
protected MemcacheClientFactory getMemcachedClientFactory(Config config) { String factoryClassName = config.getMemcachedClientFactoryName(); Constructor<?> constructor; try {/*from w w w . j a va 2 s . c om*/ constructor = Class.forName(factoryClassName).getConstructor(PropertiesHelper.class); } catch (ClassNotFoundException e) { throw new CacheException("Unable to find factory class [" + factoryClassName + "]", e); } catch (NoSuchMethodException e) { throw new CacheException( "Unable to find PropertiesHelper constructor for factory class [" + factoryClassName + "]", e); } MemcacheClientFactory clientFactory; try { clientFactory = (MemcacheClientFactory) constructor.newInstance(config.getPropertiesHelper()); } catch (Exception e) { throw new CacheException("Unable to instantiate factory class [" + factoryClassName + "]", e); } return clientFactory; }
From source file:com.googlecode.hibernate.memcached.MemcachedRegionFactory.java
License:Apache License
public void start(Settings settings, Properties properties) throws CacheException { this.settings = settings; this.properties = properties; log.info("Starting MemcachedClient..."); try {/*from w w w . jav a2s . co m*/ client = getMemcachedClientFactory(new Config(new PropertiesHelper(properties))).createMemcacheClient(); } catch (Exception e) { throw new CacheException("Unable to initialize MemcachedClient", e); } }
From source file:com.hazelcast.hibernate.access.NonStrictReadWriteAccessDelegate.java
License:Open Source License
@Override public void remove(final Object key) throws CacheException { try {//from w w w. j ava 2 s . c o m cache.remove(key); } catch (HazelcastException e) { throw new CacheException("Operation timeout during remove operation from cache!", e); } }
From source file:com.hazelcast.hibernate4.access.AbstractAccessDelegate.java
License:Open Source License
public void remove(final Object key) throws CacheException { try {//from w ww. j a v a 2 s.co m cache.remove(key); } catch (HazelcastException e) { throw new CacheException("Operation timeout during remove operation from cache!", e); } }
From source file:com.mc.hibernate.memcached.MemcachedRegionFactory.java
License:Apache License
@Override public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { this.settings = settings; this.properties = properties; log.info("Starting MemcachedClient..."); try {//from w w w. ja v a 2 s. c o m client = getMemcachedClientFactory(new Config(new PropertiesHelper(properties))).createMemcacheClient(); } catch (Exception e) { throw new CacheException("Unable to initialize MemcachedClient", e); } }
From source file:com.solace.caching.hibernate.CacheProvider.java
License:Open Source License
@Override public void start(Properties arg0) throws CacheException { try {//from w w w.j a va 2 s. c o m m_cache = super.loadImplementation(HIBERNATE_CACHE); } catch (Exception e) { throw new CacheException("Could not buildCache", e); } }
From source file:magoffin.matt.util.Hibernate3EhCacheProvider.java
License:Open Source License
/** * Callback to perform any necessary initialization of the underlying cache * implementation during SessionFactory construction. * //from w w w.j a va2 s . c o m * @param properties * current configuration settings. */ @Override public void start(Properties properties) throws CacheException { if (manager != null) { log.warn("Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() " + " between repeated calls to buildSessionFactory. Using previously created EhCacheProvider." + " If this behaviour is required, consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider."); return; } try { String configurationResourceName = null; if (properties != null) { configurationResourceName = (String) properties.get(Environment.CACHE_PROVIDER_CONFIG); } if (StringHelper.isEmpty(configurationResourceName)) { manager = CacheManager.create(); } else { URL url = loadResource(configurationResourceName); manager = CacheManager.create(url); } } catch (net.sf.ehcache.CacheException e) { // yukky! Don't you have subclasses for that! // race conditions can happen here if (e.getMessage() .startsWith("Cannot parseConfiguration CacheManager. Attempt to create a new instance of " + "CacheManager using the diskStorePath")) { throw new CacheException( "Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() " + " between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider.", e); } throw e; } }
From source file:org.cacheonix.plugin.hibernate.v32.HibernateCacheonixCacheProvider.java
License:LGPL
/** * Callback to perform any necessary initialization of the underlying cache implementation during SessionFactory * construction./*from www. j a va2 s.c o m*/ * * @param properties current configuration settings. * @noinspection OverlyBroadCatchBlock, ProhibitedExceptionThrown */ public void start(final Properties properties) throws CacheException { LOG.info("Starting Cacheonix cache provider"); try { if (cacheonix == null) { final String cacheonixConfigPath = properties.getProperty(Environment.CACHE_PROVIDER_CONFIG, Cacheonix.CACHEONIX_XML); LOG.info("Using path to cacheonix configuration file or resource: " + cacheonixConfigPath); cacheonix = Cacheonix.getInstance(cacheonixConfigPath); LOG.info( "Started Cacheonix cache provider using path to confiuration file: " + cacheonixConfigPath); } else { LOG.warn("Cacheonix cache provider has been started already"); } } catch (final RuntimeException e) { throw e; } catch (final Exception e) { throw new CacheException(StringUtils.toString(e), e); } }