Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.disconnect()


  Thread t = new Thread(new Runnable() {
      public void run() {
    try {
        Jedis j = createJedis();
        j.publish(channel, message);
        j.disconnect();
    } catch (Exception ex) {
    }
      }
  });
  t.start();
View Full Code Here


        // 10M * 10 = 100M
        for (int i = 0; i < 10 && !exit.get(); i++) {
      j.publish("foo", veryLargeString);
        }

        j.disconnect();
    } catch (Exception ex) {
    }
      }
  });
  t.start();
View Full Code Here

    Jedis j = new Jedis("localhost");
    j.auth("foobared");
    for (int i = 0; i < 5; i++) {
        j.incr("foobared");
    }
    j.disconnect();
      }
  }).start();

  jedis.monitor(new JedisMonitor() {
      private int count = 0;
View Full Code Here

  }
  p.sync();

  long elapsed = Calendar.getInstance().getTimeInMillis() - begin;

  jedis.disconnect();

  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
    }
}
View Full Code Here

      jedis.get(key);
  }

  long elapsed = Calendar.getInstance().getTimeInMillis() - begin;

  jedis.disconnect();

  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
    }
}
View Full Code Here

  Jedis j = new Jedis(hnp.getHost(), hnp.getPort());
  j.connect();
  j.auth("foobared");
  j.flushAll();
  j.quit();
  j.disconnect();
  long t = System.currentTimeMillis();
  // withoutPool();
  withPool();
  long elapsed = System.currentTimeMillis() - t;
  System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
View Full Code Here

              jedis.connect();
              String strKey = hashKeys.next();
              currentHashMonth = MONTH_FROM_STRING.get(strKey);
              hashIterator = jedis.hgetAll(strKey).entrySet()
                  .iterator();
              jedis.disconnect();
            }
          }

          // If the key/value map still has values
          if (hashIterator.hasNext()) {
View Full Code Here

        // Get all the key value pairs from the Redis instance and store
        // them in memory
        totalKVs = jedis.hlen(hashKey);
        keyValueMapIter = jedis.hgetAll(hashKey).entrySet().iterator();
        LOG.info("Got " + totalKVs + " from " + hashKey);
        jedis.disconnect();
      }

      @Override
      public boolean nextKeyValue() throws IOException,
          InterruptedException {
View Full Code Here

    }

    private static void changeRedisTimeout(final long seconds) {
        final Jedis jedis = TestUtils.createJedis(config);
        jedis.configSet("timeout", Long.toString(seconds));
        jedis.disconnect();
    }

    @Before
    public void resetRedis() throws Exception {
        TestUtils.resetRedis(config);
View Full Code Here

    }
   
    @Test
    public void testEnsureJedisConnection_Fail() {
        final Jedis jedis = createJedis(CONFIG);
        jedis.disconnect();
        Assert.assertFalse(JedisUtils.ensureJedisConnection(jedis));
        Assert.assertTrue(JedisUtils.testJedisConnection(jedis));
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.