use of org.redisson.config.Config in project redisson by redisson.
the class RedissonTest method testElasticacheConnectionFail.
@Test(expected = RedisConnectionException.class)
public void testElasticacheConnectionFail() throws InterruptedException {
Config config = new Config();
config.useElasticacheServers().addNodeAddress("127.99.0.1:1111");
Redisson.create(config);
Thread.sleep(1500);
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonTest method testMasterSlaveConfigJSON.
@Test
public void testMasterSlaveConfigJSON() throws IOException {
Config c2 = new Config();
c2.useMasterSlaveServers().setMasterAddress("123.1.1.1:1231").addSlaveAddress("82.12.47.12:1028");
String t = c2.toJSON();
Config c = Config.fromJSON(t);
assertThat(c.toJSON()).isEqualTo(t);
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonSessionManager method start.
@Override
public void start() throws LifecycleException {
Config config = null;
try {
config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
} catch (IOException e) {
// trying next format
try {
config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
} catch (IOException e1) {
log.error("Can't parse json config " + configPath, e);
throw new LifecycleException("Can't parse yaml config " + configPath, e1);
}
}
try {
redisson = Redisson.create(config);
} catch (Exception e) {
throw new LifecycleException(e);
}
lifecycle.fireLifecycleEvent(START_EVENT, null);
}
use of org.redisson.config.Config in project redisson by redisson.
the class JCachingProvider method loadConfig.
private Config loadConfig(URI uri) {
Config config = null;
try {
URL jsonUrl = null;
if (DEFAULT_URI_PATH.equals(uri.getPath())) {
jsonUrl = JCachingProvider.class.getResource("/redisson-jcache.json");
} else {
jsonUrl = uri.toURL();
}
if (jsonUrl == null) {
throw new IOException();
}
config = Config.fromJSON(jsonUrl);
} catch (IOException e) {
try {
URL yamlUrl = null;
if (DEFAULT_URI_PATH.equals(uri.getPath())) {
yamlUrl = JCachingProvider.class.getResource("/redisson-jcache.yaml");
} else {
yamlUrl = uri.toURL();
}
if (yamlUrl != null) {
config = Config.fromYAML(yamlUrl);
}
} catch (IOException e2) {
// skip
}
}
return config;
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonLocalCachedMapSerializationCodecTest method createConfig.
public static Config createConfig() {
Config config = RedissonLocalCachedMapTest.createConfig();
config.setCodec(new SerializationCodec());
return config;
}
Aggregations