RedissonRegionFactory.createRedissonClient method introduced

pull/1792/head
Nikita Koksharov 6 years ago
parent ca8c7f88a1
commit ce3fd29f70

@ -81,6 +81,11 @@ public class RedissonRegionFactory implements RegionFactory {
@Override
public void start(Settings settings, Properties properties) throws CacheException {
this.redisson = createRedissonClient(properties);
this.settings = settings;
}
protected RedissonClient createRedissonClient(Properties properties) {
Config config = null;
if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
@ -99,8 +104,7 @@ public class RedissonRegionFactory implements RegionFactory {
throw new CacheException("Unable to locate Redisson configuration");
}
this.redisson = Redisson.create(config);
this.settings = settings;
return Redisson.create(config);
}
private Config loadConfig(String configPath) {

@ -82,6 +82,11 @@ public class RedissonRegionFactory implements RegionFactory {
@Override
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {
this.redisson = createRedissonClient(properties);
this.settings = new Settings(settings);
}
protected RedissonClient createRedissonClient(Properties properties) {
Config config = null;
if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
@ -100,8 +105,7 @@ public class RedissonRegionFactory implements RegionFactory {
throw new CacheException("Unable to locate Redisson configuration");
}
this.redisson = Redisson.create(config);
this.settings = new Settings(settings);
return Redisson.create(config);
}
private Config loadConfig(String configPath) {

@ -82,6 +82,11 @@ public class RedissonRegionFactory implements RegionFactory {
@Override
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {
this.redisson = createRedissonClient(properties);
this.settings = new Settings(settings);
}
protected RedissonClient createRedissonClient(Properties properties) {
Config config = null;
if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
@ -100,10 +105,9 @@ public class RedissonRegionFactory implements RegionFactory {
throw new CacheException("Unable to locate Redisson configuration");
}
this.redisson = Redisson.create(config);
this.settings = new Settings(settings);
return Redisson.create(config);
}
private Config loadConfig(String configPath) {
try {
return Config.fromJSON(new File(configPath));

@ -73,6 +73,10 @@ public class RedissonRegionFactory extends RegionFactoryTemplate {
@Override
protected void prepareForUse(SessionFactoryOptions settings, @SuppressWarnings("rawtypes") Map properties) throws CacheException {
this.redisson = createRedissonClient(properties);
}
protected RedissonClient createRedissonClient(Map properties) {
Config config = null;
if (!properties.containsKey(REDISSON_CONFIG_PATH)) {
config = loadConfig(RedissonRegionFactory.class.getClassLoader(), "redisson.json");
@ -91,9 +95,9 @@ public class RedissonRegionFactory extends RegionFactoryTemplate {
throw new CacheException("Unable to locate Redisson configuration");
}
this.redisson = Redisson.create(config);
return Redisson.create(config);
}
private Config loadConfig(String configPath) {
try {
return Config.fromJSON(new File(configPath));

Loading…
Cancel
Save