当前位置: 首页>>代码示例>>Java>>正文


Java Protocol.DEFAULT_DATABASE属性代码示例

本文整理汇总了Java中redis.clients.jedis.Protocol.DEFAULT_DATABASE属性的典型用法代码示例。如果您正苦于以下问题:Java Protocol.DEFAULT_DATABASE属性的具体用法?Java Protocol.DEFAULT_DATABASE怎么用?Java Protocol.DEFAULT_DATABASE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在redis.clients.jedis.Protocol的用法示例。


在下文中一共展示了Protocol.DEFAULT_DATABASE属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JaRedisPool

public JaRedisPool(final String host) {
    URI uri = URI.create(host);
    if (JedisURIHelper.isValid(uri)) {
        String h = uri.getHost();
        int port = uri.getPort();
        String password = JedisURIHelper.getPassword(uri);
        int database = JedisURIHelper.getDBIndex(uri);
        this.internalPool = new GenericObjectPool<>(new JaRedisFactory(h, port,
                Protocol.DEFAULT_TIMEOUT, Protocol.DEFAULT_TIMEOUT, password, database, null),
                new GenericObjectPoolConfig());
    } else {
        this.internalPool = new GenericObjectPool<>(new JaRedisFactory(host,
                Protocol.DEFAULT_PORT, Protocol.DEFAULT_TIMEOUT, Protocol.DEFAULT_TIMEOUT, null,
                Protocol.DEFAULT_DATABASE, null), new GenericObjectPoolConfig());
    }
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:16,代码来源:JaRedisPool.java

示例2: JedisSentinelPoolExt

public JedisSentinelPoolExt(String masterName, String sentinels, final GenericObjectPoolConfig poolConfig,
		final String password, int connectionTimeout, int failMax, boolean masterWriteOnly, String clientName) {

	String[] strings = sentinels.split(",");
	Collections.addAll(_sentinels, strings);

	this.poolConfig = poolConfig;
	this.connectionTimeout = connectionTimeout;
	if (!StringUtils.isBlank(password)) {
		this.password = password;
	}
	this.database = Protocol.DEFAULT_DATABASE;
	this.failMax = failMax;
	this.masterName = masterName;
	this.masterWriteOnly = masterWriteOnly;
	if (!StringUtils.isBlank(clientName)) {
		this.clientName = clientName;
	}

	HostAndPort master = initSentinels(_sentinels, masterName);
	initPool(master);

	initReadPool();
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:24,代码来源:JedisSentinelPoolExt.java

示例3: insertReadPool

/**
 * 读池增加新节点
 * 
 * @param hostAndPort
 */
protected synchronized void insertReadPool(HostAndPort hostAndPort) {
	boolean exists = false;
	for (JedisPoolExt oldJedisPool : jedisReadPools) {
		if (oldJedisPool.getHostAndPort().equals(hostAndPort)) {
			exists = true;
			break;
		}
	}
	if (!exists) {
		JedisPoolExt newJedisPool = new JedisPoolExt(poolConfig, hostAndPort.getHost(), hostAndPort.getPort(),
				connectionTimeout, password, Protocol.DEFAULT_DATABASE, clientName);
		jedisReadPools.add(newJedisPool);

		// 新来的节点,可能是之前挂掉后恢复的节点,所以要检查其是否存在于失败列表中,要去除
		failMap.remove(hostAndPort);

		log.info("Add JedisReadPool at " + hostAndPort);
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:24,代码来源:JedisSentinelPoolExt.java

示例4: RedisPool

public RedisPool(final String host) {
    URI uri = URI.create(host);
    if (uri.getScheme() != null && uri.getScheme().equals("redis")) {
        String h = uri.getHost();
        int port = uri.getPort();
        String password = JedisURIHelper.getPassword(uri);
        int database = 0;
        Integer dbIndex = JedisURIHelper.getDBIndex(uri);
        if (dbIndex != null) {
            database = dbIndex.intValue();
        }
        this.internalPool = new GenericObjectPool<BinaryJedis>(
                new BinaryJedisFactory(h, port, Protocol.DEFAULT_TIMEOUT,
                        password, database, null),
                new GenericObjectPoolConfig());
    } else {
        this.internalPool = new GenericObjectPool<BinaryJedis>(new BinaryJedisFactory(
                host, Protocol.DEFAULT_PORT, Protocol.DEFAULT_TIMEOUT,
                null, Protocol.DEFAULT_DATABASE, null),
                new GenericObjectPoolConfig());
    }
}
 
开发者ID:yamingd,项目名称:argo,代码行数:22,代码来源:RedisPool.java

示例5: DecoratedJedisPool

private DecoratedJedisPool(JedisPoolConfig jedisPoolConfig, String host, int port) {
  super(jedisPoolConfig, host, port,
      Config.getInstance().getJedisConnectTimeoutMs(),
      Config.getInstance().getJedisSocketTimeoutMs(),
      Config.getInstance().getRedisPassword(),
      Protocol.DEFAULT_DATABASE, null);

  this.host = host;
  this.port = port;
}
 
开发者ID:XiaoMi,项目名称:ECFileCache,代码行数:10,代码来源:DecoratedJedisPool.java

示例6: activateService

@Override
public void activateService()
    throws Exception
{
    configuration.refresh();
    RedisEntityStoreConfiguration config = configuration.get();

    String host = config.host().get() == null ? DEFAULT_HOST : config.host().get();
    int port = config.port().get() == null ? Protocol.DEFAULT_PORT : config.port().get();
    int timeout = config.timeout().get() == null ? Protocol.DEFAULT_TIMEOUT : config.timeout().get();
    String password = config.password().get();
    int database = config.database().get() == null ? Protocol.DEFAULT_DATABASE : config.database().get();

    pool = new JedisPool( new JedisPoolConfig(), host, port, timeout, password, database );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:15,代码来源:RedisEntityStoreMixin.java

示例7: JedisManager

private JedisManager() {
	String host = System.getenv("REDIS_HOST");
	String port = System.getenv("REDIS_PORT");

	factory = new JedisFactory(host == null ? "" : host, port == null ? 6379 : Integer.valueOf(port),
			Protocol.DEFAULT_TIMEOUT, Protocol.DEFAULT_TIMEOUT, null, Protocol.DEFAULT_DATABASE, null);
}
 
开发者ID:eleme,项目名称:hackathon-2015,代码行数:7,代码来源:JedisManager.java

示例8: run

@Override
public void run(BiblioConfiguration configuration, Environment environment) throws Exception {
    final IdGenerator idGenerator = new IdGenerator();
    environment.jersey().register(new UnexpectedExceptionMapper(idGenerator));
    environment.jersey().register(AuthenticationErrorMapper.class);
    environment.jersey().register(UnauthorizedExceptionMapper.class);
    environment.jersey().register(IllegalArgumentExceptionMapper.class);

    final CacheConfiguration cacheConfig = configuration.getCacheConfiguration();
    final JedisPool pool = new JedisPool(new GenericObjectPoolConfig(), cacheConfig.getAddress(),
            cacheConfig.getPort(), cacheConfig.getSessionExpiration(), cacheConfig.getPassword(), Protocol.DEFAULT_DATABASE);

    final Jedis jedis = pool.getResource();
    pool.returnResource(jedis);

    final UserDao userDao = new UserDao(hibernate.getSessionFactory());
    final BookDao bookDao = new BookDao(hibernate.getSessionFactory());

    final SessionDao sessionDao = new SessionDao(pool, configuration.getCacheConfiguration());

    environment.jersey().register(new UserResource(userDao, sessionDao));
    environment.jersey().register(new BarCodeResource(bookDao));
    environment.jersey().register(new BookResource(bookDao));
    environment.jersey().register(new IsbnResource(bookDao));
    environment.jersey().register(new LendResource());

    environment.jersey().register(
            AuthFactory.binder(
                    new TokenAuthFactory<>(
                            new UserAuthenticator(userDao, sessionDao),
                            "SECURITY REALM",
                            User.class)));

}
 
开发者ID:adelolmo,项目名称:biblio-server,代码行数:34,代码来源:BiblioApplication.java

示例9: JaRedisSentinelPool

public JaRedisSentinelPool(String masterName, Set<String> sentinels,
                           final GenericObjectPoolConfig poolConfig) {
    this(masterName, sentinels, poolConfig, Protocol.DEFAULT_TIMEOUT, null,
            Protocol.DEFAULT_DATABASE);
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:5,代码来源:JaRedisSentinelPool.java

示例10: ResilientJedisConnectionFactory

public ResilientJedisConnectionFactory(String masterHostName, Set<String> sentinels, String password) {
    this(masterHostName, sentinels, password, Protocol.DEFAULT_DATABASE);
}
 
开发者ID:Dennyss,项目名称:sharded-spring-data-redis,代码行数:3,代码来源:ResilientJedisConnectionFactory.java

示例11: HostConfiguration

public HostConfiguration(String host, int port) {
    this( host, port, Protocol.DEFAULT_TIMEOUT, Protocol.DEFAULT_DATABASE );
}
 
开发者ID:officedrop,项目名称:jedis_failover,代码行数:3,代码来源:HostConfiguration.java

示例12: GenericJedisClient

public GenericJedisClient(String host, int port, int timeout, int database) {
    super(host, port, timeout);
    if ( database != Protocol.DEFAULT_DATABASE) {
        this.select(database);
    }
}
 
开发者ID:officedrop,项目名称:jedis_failover,代码行数:6,代码来源:GenericJedisClient.java


注:本文中的redis.clients.jedis.Protocol.DEFAULT_DATABASE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。