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


Java JedisPool.returnResourceObject方法代码示例

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


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

示例1: getAllKeys

import redis.clients.jedis.JedisPool; //导入方法依赖的package包/类
public Set<String> getAllKeys() {
    Set<String> keysSet = new HashSet();
    Collection<JedisPool> poolCollection = jedisCluster.getClusterNodes().values();
    Iterator iterator = poolCollection.iterator();

    while(iterator.hasNext()) {
        JedisPool jedisPool = (JedisPool)iterator.next();
        Jedis jedis = null;

        try {
            jedis = jedisPool.getResource();
            keysSet.addAll(jedis.keys("*"));
        } catch (Exception var10) {
            throw new RuntimeException(var10);
        } finally {
            jedisPool.returnResourceObject(jedis);
        }
    }

    return keysSet;
}
 
开发者ID:bitstd,项目名称:bitstd,代码行数:22,代码来源:RedisCacheWithCluster.java

示例2: publish

import redis.clients.jedis.JedisPool; //导入方法依赖的package包/类
public void publish(String channel, String message) {
    Collection<JedisPool> poolCollection = jedisCluster.getClusterNodes().values();
    Iterator<JedisPool> iterator = poolCollection.iterator();
    if (iterator.hasNext()) {
        JedisPool jedisPool = (JedisPool)iterator.next();
        Jedis jedis = null;

        try {
            jedis = jedisPool.getResource();
            jedis.publish(channel, message);
        } catch (Exception var11) {
            throw new RuntimeException(var11);
        } finally {
            jedisPool.returnResourceObject(jedis);
        }
    }

}
 
开发者ID:bitstd,项目名称:bitstd,代码行数:19,代码来源:RedisCacheWithCluster.java

示例3: subscribe

import redis.clients.jedis.JedisPool; //导入方法依赖的package包/类
public void subscribe(JedisPubSub jedisPubSub, String channel) {
    Collection<JedisPool> poolCollection = jedisCluster.getClusterNodes().values();
    Iterator iterator = poolCollection.iterator();

    while(iterator.hasNext()) {
        JedisPool jedisPool = (JedisPool)iterator.next();
        Jedis jedis = null;

        try {
            jedis = jedisPool.getResource();
            jedis.subscribe(jedisPubSub, new String[]{channel});
        } catch (Exception var11) {
            throw new RuntimeException(var11);
        } finally {
            jedisPool.returnResourceObject(jedis);
        }
    }

}
 
开发者ID:bitstd,项目名称:bitstd,代码行数:20,代码来源:RedisCacheWithCluster.java

示例4: returnNullObjectShouldNotFail

import redis.clients.jedis.JedisPool; //导入方法依赖的package包/类
@Test
public void returnNullObjectShouldNotFail() {
  JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(), hnp.getPort(), 2000,
      "foobared", 0, "my_shiny_client_name");

  pool.returnBrokenResource(null);
  pool.returnResource(null);
  pool.returnResourceObject(null);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:JedisPoolTest.java


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