org.redisson.Redisson.create()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(431)

本文整理了Java中org.redisson.Redisson.create方法的一些代码示例,展示了Redisson.create的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Redisson.create方法的具体详情如下:
包路径:org.redisson.Redisson
类名称:Redisson
方法名:create

Redisson.create介绍

[英]Create sync/async Redisson instance with default config
[中]使用默认配置创建同步/异步Redisson实例

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Creates factory with default Redisson configuration
 */
public RedissonConnectionFactory() {
  this(Redisson.create());
}

代码示例来源:origin: redisson/redisson

@Override
public void afterPropertiesSet() throws Exception {
  if (config != null) {
    redisson = Redisson.create(config);
  }
}

代码示例来源:origin: redisson/redisson

@Override
public void afterPropertiesSet() throws Exception {
  if (config != null) {
    redisson = Redisson.create(config);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Creates factory with default Redisson configuration
 */
public RedissonConnectionFactory() {
  this(Redisson.create());
}

代码示例来源:origin: redisson/redisson

/**
 * Creates factory with default Redisson configuration
 */
public RedissonConnectionFactory() {
  this(Redisson.create());
}

代码示例来源:origin: redisson/redisson

@Override
public void afterPropertiesSet() throws Exception {
  if (config != null) {
    redisson = Redisson.create(config);
  }
}

代码示例来源:origin: redisson/redisson

@Override
public void afterPropertiesSet() throws Exception {
  if (config != null) {
    redisson = Redisson.create(config);
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Creates factory with default Redisson configuration
 */
public RedissonConnectionFactory() {
  this(Redisson.create());
}

代码示例来源:origin: mrniko/netty-socketio

public RedissonStoreFactory() {
  this(Redisson.create());
}

代码示例来源:origin: redisson/redisson

protected RedissonClient buildClient(String configPath) throws NamingException {
  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) {
      NamingException ex = new NamingException("Can't parse yaml config " + configPath);
      ex.initCause(e1);
      throw ex;
    }
  }
  
  try {
    return Redisson.create(config);
  } catch (Exception e) {
    NamingException ex = new NamingException();
    ex.initCause(e);
    throw ex;
  }
}

代码示例来源:origin: redisson/redisson

protected RedissonClient buildClient() 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 {
    return Redisson.create(config);
  } catch (Exception e) {
    throw new LifecycleException(e);
  }
}

代码示例来源:origin: redisson/redisson

protected RedissonClient buildClient() 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 {
    return Redisson.create(config);
  } catch (Exception e) {
    throw new LifecycleException(e);
  }
}

代码示例来源:origin: redisson/redisson

protected RedissonClient buildClient() 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 {
    return Redisson.create(config);
  } catch (Exception e) {
    throw new LifecycleException(e);
  }
}

代码示例来源:origin: redisson/redisson

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);
}

代码示例来源:origin: redisson/redisson

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);
}

代码示例来源:origin: redisson/redisson

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);
}

代码示例来源:origin: redisson/redisson

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);
}

代码示例来源:origin: redisson/redisson

/**
   * Create sync/async Redisson instance with default config
   *
   * @return Redisson instance
   */
  public static RedissonClient create() {
    Config config = new Config();
    config.useSingleServer()
    .setTimeout(1000000)
    .setAddress("redis://127.0.0.1:6379");
//        config.useMasterSlaveConnection().setMasterAddress("127.0.0.1:6379").addSlaveAddress("127.0.0.1:6389").addSlaveAddress("127.0.0.1:6399");
//        config.useSentinelConnection().setMasterName("mymaster").addSentinelAddress("127.0.0.1:26389", "127.0.0.1:26379");
//        config.useClusterServers().addNodeAddress("127.0.0.1:7000");
    return create(config);
  }

代码示例来源:origin: redisson/redisson

/**
   * Create sync/async Redisson instance with default config
   *
   * @return Redisson instance
   */
  public static RedissonClient create() {
    Config config = new Config();
    config.useSingleServer()
    .setTimeout(1000000)
    .setAddress("redis://127.0.0.1:6379");
//        config.useMasterSlaveConnection().setMasterAddress("127.0.0.1:6379").addSlaveAddress("127.0.0.1:6389").addSlaveAddress("127.0.0.1:6399");
//        config.useSentinelConnection().setMasterName("mymaster").addSentinelAddress("127.0.0.1:26389", "127.0.0.1:26379");
//        config.useClusterServers().addNodeAddress("127.0.0.1:7000");
    return create(config);
  }

代码示例来源:origin: killbill/killbill

@Override
  public RedissonClient get() {
    // JDK serialization codec for now, but we can do better in speed and space
    final Codec codec = new SerializationCodec();

    final Config redissonCfg = new Config();
    redissonCfg.setCodec(codec)
          .useSingleServer()
          .setAddress(address)
          .setConnectionMinimumIdleSize(connectionMinimumIdleSize);
    return Redisson.create(redissonCfg);
  }
}

相关文章