Package redis.clients.jedis

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


    public void checkPoolRepairedWhenJedisIsBroken() {
  JedisPool pool = new JedisPool(new JedisPoolConfig(), hnp.getHost(),
    hnp.getPort());
  Jedis jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.quit();
  pool.returnBrokenResource(jedis);

  jedis = pool.getResource();
  jedis.auth("foobared");
  jedis.incr("foo");
View Full Code Here


    public static void main(String[] args) throws Exception {
  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;
View Full Code Here

            Assert.assertEquals(String.valueOf(20), jedis.get(createKey(config.getNamespace(), STAT, PROCESSED)));
            Assert.assertNull(jedis.get(createKey(config.getNamespace(), STAT, FAILED)));
            Assert.assertEquals(Long.valueOf(0),
                    jedis.zcount(createKey(config.getNamespace(), QUEUE, delayTestQueue), "-inf", "+inf"));
        } finally {
            jedis.quit();
        }
    }
}
View Full Code Here

        final Jedis jedis = createJedis(config);
        try {
            log.info("Resetting Redis for next test...");
            jedis.flushDB();
        } finally {
            jedis.quit();
        }
    }

    /**
     * Create a connection to Redis from the given Config.
View Full Code Here

        final Jedis jedis = createJedis(CONFIG);
        try {
            Assert.assertEquals("1", jedis.get(createKey(CONFIG.getNamespace(), STAT, PROCESSED)));
            Assert.assertNull(jedis.get(createKey(CONFIG.getNamespace(), STAT, FAILED)));
        } finally {
            jedis.quit();
        }
    }

    public static class SendMailJob implements Runnable {
       
View Full Code Here

        TestUtils.enqueueJobs(testQueue, Arrays.asList(job), config);
        Jedis jedis = createJedis(config);
        try { // Assert that we enqueued the job
            Assert.assertEquals(Long.valueOf(1), jedis.llen(createKey(config.getNamespace(), QUEUE, testQueue)));
        } finally {
            jedis.quit();
        }

        // Create and start worker
        final Worker worker = new WorkerImpl(config, Arrays.asList(testQueue),
                new MapBasedJobFactory(map(entry("TestAction", TestAction.class))));
View Full Code Here

        try {
            Assert.assertEquals("1", jedis.get(createKey(config.getNamespace(), STAT, PROCESSED)));
            Assert.assertNull(jedis.get(createKey(config.getNamespace(), STAT, FAILED)));
            Assert.assertEquals(Long.valueOf(0), jedis.llen(createKey(config.getNamespace(), QUEUE, testQueue)));
        } finally {
            jedis.quit();
        }
    }
}
View Full Code Here

        try {
            Assert.assertTrue(didFailWithUnpermittedJob.get());
            Assert.assertEquals("1", jedis.get(createKey(CONFIG.getNamespace(), STAT, FAILED)));
            Assert.assertNull(jedis.get(createKey(CONFIG.getNamespace(), STAT, PROCESSED)));
        } finally {
            jedis.quit();
        }
    }

    private static void assertSuccess(final WorkerListener listener, final WorkerEvent... events) {
        final Job job = new Job("TestAction", new Object[] { 1, 2.3, true, "test", Arrays.asList("inner", 4.5) });
View Full Code Here

        final Jedis jedis = createJedis(CONFIG);
        try {
            Assert.assertEquals("1", jedis.get(createKey(CONFIG.getNamespace(), STAT, PROCESSED)));
            Assert.assertNull(jedis.get(createKey(CONFIG.getNamespace(), STAT, FAILED)));
        } finally {
            jedis.quit();
        }
    }

    private static void assertFailure(final WorkerListener listener, final WorkerEvent... events) {
        final Job job = new Job("FailAction");
View Full Code Here

        final Jedis jedis = createJedis(CONFIG);
        try {
            Assert.assertEquals("1", jedis.get(createKey(CONFIG.getNamespace(), STAT, FAILED)));
            Assert.assertNull(jedis.get(createKey(CONFIG.getNamespace(), STAT, PROCESSED)));
        } finally {
            jedis.quit();
        }
    }

    private static void assertMixed(final WorkerListener listener, final WorkerEvent... events) {
        final Job job1 = new Job("FailAction");
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.