use of org.hibernate.cache.CacheException in project redisson by redisson.
the class RedissonRegionFactory method createRedissonClient.
protected RedissonClient createRedissonClient(Properties properties) {
Config config = null;
if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
if (config == null) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.yaml");
}
} else {
String configPath = ConfigurationHelper.getString(REDISSON_CONFIG_PATH, properties);
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), configPath);
if (config == null) {
config = loadConfig(configPath);
}
}
if (config == null) {
throw new CacheException("Unable to locate Redisson configuration");
}
return Redisson.create(config);
}
use of org.hibernate.cache.CacheException in project redisson by redisson.
the class JndiRedissonRegionFactory method createRedissonClient.
@Override
protected RedissonClient createRedissonClient(Map properties) {
String jndiName = ConfigurationHelper.getString(JNDI_NAME, properties);
if (jndiName == null) {
throw new CacheException(JNDI_NAME + " property not set");
}
Properties jndiProperties = JndiServiceImpl.extractJndiProperties(properties);
InitialContext context = null;
try {
context = new InitialContext(jndiProperties);
return (RedissonClient) context.lookup(jndiName);
} catch (NamingException e) {
throw new CacheException("Unable to locate Redisson instance by name: " + jndiName, e);
} finally {
if (context != null) {
try {
context.close();
} catch (NamingException e) {
throw new CacheException("Unable to close JNDI context", e);
}
}
}
}
use of org.hibernate.cache.CacheException in project redisson by redisson.
the class RedissonRegionFactory method createRedissonClient.
protected RedissonClient createRedissonClient(Map properties) {
Config config = null;
if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
if (config == null) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.yaml");
}
} else {
String configPath = ConfigurationHelper.getString(REDISSON_CONFIG_PATH, properties);
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), configPath);
if (config == null) {
config = loadConfig(configPath);
}
}
if (config == null) {
throw new CacheException("Unable to locate Redisson configuration");
}
return Redisson.create(config);
}
use of org.hibernate.cache.CacheException in project uPortal by Jasig.
the class SpringBeanEhCacheRegionFactory method start.
@Override
public void start(Settings settings, Properties properties) throws CacheException {
this.settings = settings;
try {
String cacheManagerBeanName = null;
if (properties != null) {
cacheManagerBeanName = StringUtils.trimToNull(properties.getProperty(CACHE_MANAGER_NAME));
}
if (cacheManagerBeanName == null) {
throw new IllegalArgumentException("The '" + CACHE_MANAGER_NAME + "' property must be set");
}
logger.debug("Getting CacheManager bean named {}", cacheManagerBeanName);
manager = CacheManager.getCacheManager(cacheManagerBeanName);
mbeanRegistrationHelper.registerMBean(manager, properties);
} catch (net.sf.ehcache.CacheException e) {
throw new CacheException(e);
}
}
use of org.hibernate.cache.CacheException in project hibernate-orm by hibernate.
the class JCacheRegionFactory method getCacheManager.
protected CacheManager getCacheManager(final Properties properties) {
final CachingProvider cachingProvider = getCachingProvider(properties);
final CacheManager cacheManager;
final String cacheManagerUri = getProp(properties, CONFIG_URI);
if (cacheManagerUri != null) {
URI uri;
try {
uri = new URI(cacheManagerUri);
} catch (URISyntaxException e) {
throw new CacheException("Couldn't create URI from " + cacheManagerUri, e);
}
cacheManager = cachingProvider.getCacheManager(uri, cachingProvider.getDefaultClassLoader());
} else {
cacheManager = cachingProvider.getCacheManager();
}
return cacheManager;
}
Aggregations