コード例 #1
0
    @Override
    public void run() {

      RedisListener rl = new RedisListener();

      jedis = jedisPool.getResource();
      jedis.connect();

      logger.trace("Redis Subscriber ({}):  subscribing to {}.", id, channel);

      jedis.subscribe(rl, channel);

      logger.debug("Redis Subscriber ({}):  Exiting.", id);

      setComplete();
    }
コード例 #2
0
    @Override
    public void run() {

      logger.debug("RedisPublisher:  {}  Starting.", id);
      Jedis jedis = jedisPool.getResource();
      jedis.connect();

      logger.debug("RedisPublisher:  {}  connected.", id);

      for (int i = 0; i < testCount; i++) {
        jedis.publish(channel, REDIS_PAYLOAD);
        tallyMessage();
      }

      logger.debug("Redis Publisher ({}) :  Published {} messages", id, testCount);

      jedis.disconnect();

      setComplete();
    }