List of usage examples for org.hibernate.engine.jndi.internal JndiServiceImpl extractJndiProperties
@SuppressWarnings({ "unchecked" })
public static Properties extractJndiProperties(Map configurationValues)
From source file:org.redisson.hibernate.JndiRedissonRegionFactory.java
License:Apache License
@Override protected RedissonClient createRedissonClient(Map properties) { String jndiName = ConfigurationHelper.getString(JNDI_NAME, properties); if (jndiName == null) { throw new CacheException(JNDI_NAME + " property not set"); }/* w w w . j av a2 s . co m*/ 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); } } } }