Package net.greghaines.jesque.client

Examples of net.greghaines.jesque.client.Client


        jedis.select(config.getDatabase());
        return jedis;
    }

    public static void enqueueJobs(final String queue, final List<Job> jobs, final Config config) {
        final Client client = new ClientImpl(config);
        try {
            for (final Job job : jobs) {
                client.enqueue(queue, job);
            }
        } finally {
            client.end();
        }
    }
View Full Code Here


            log.warn("Exception while waiting for workerThread to join", e);
        }
    }

    public static void delayEnqueueJobs(final String queue, final List<Job> jobs, final Config config) {
        final Client client = new ClientImpl(config);
        try {
            int i = 1;
            for (final Job job : jobs) {
                final long value = System.currentTimeMillis() + (500 * i++);
                client.delayedEnqueue(queue, job, value);
            }
        } finally {
            client.end();
        }
    }
View Full Code Here

    }

    @Test
    public void acquireLockSuccess() {
        LOG.info("Running acquireLockSuccess()...");
        final Client client = new ClientImpl(CONFIG);
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "me", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "me", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "me", 10));
    }
View Full Code Here

    }

    @Test
    public void acquireLockFail() {
        LOG.info("Running acquireLockFail()...");
        final Client client = new ClientImpl(CONFIG);
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
        Assert.assertFalse("Acquired lock that should have been in use.",
                client.acquireLock("systemLockA", "george", 10));
        Assert.assertTrue("Failed to acquire the expected lock.", client.acquireLock("systemLockA", "pete", 10000));
    }
View Full Code Here

TOP

Related Classes of net.greghaines.jesque.client.Client

Copyright © 2018 www.massapicom. 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.