Package org.redisson.core

Examples of org.redisson.core.RCountDownLatch.trySetCount()


        Redisson redisson = Redisson.create();

        ExecutorService executor = Executors.newFixedThreadPool(2);

        final RCountDownLatch latch = redisson.getCountDownLatch("latch1");
        Assert.assertTrue(latch.trySetCount(1));

        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
View Full Code Here


        Redisson redisson = Redisson.create();

        ExecutorService executor = Executors.newFixedThreadPool(2);

        final RCountDownLatch latch = redisson.getCountDownLatch("latch1");
        Assert.assertTrue(latch.trySetCount(1));

        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
View Full Code Here

    @Test
    public void testCountDown() throws InterruptedException {
        Redisson redisson = Redisson.create();
        RCountDownLatch latch = redisson.getCountDownLatch("latch");
        latch.trySetCount(1);
        Assert.assertEquals(1, latch.getCount());
        latch.countDown();
        Assert.assertEquals(0, latch.getCount());
        latch.await();
        latch.countDown();
View Full Code Here

        latch.countDown();
        Assert.assertEquals(0, latch.getCount());
        latch.await();

        RCountDownLatch latch1 = redisson.getCountDownLatch("latch1");
        latch1.trySetCount(1);
        latch1.countDown();
        Assert.assertEquals(0, latch.getCount());
        latch1.countDown();
        Assert.assertEquals(0, latch.getCount());
        latch1.await();
View Full Code Here

        latch1.countDown();
        Assert.assertEquals(0, latch.getCount());
        latch1.await();

        RCountDownLatch latch2 = redisson.getCountDownLatch("latch2");
        latch2.trySetCount(1);
        latch2.countDown();
        latch2.await();
        latch2.await();

        RCountDownLatch latch3 = redisson.getCountDownLatch("latch3");
View Full Code Here

    public void testSingleCountDownAwait_SingleInstance() throws InterruptedException {
        final int iterations = Runtime.getRuntime().availableProcessors()*3;

        Redisson redisson = Redisson.create();
        final RCountDownLatch latch = redisson.getCountDownLatch("latch");
        latch.trySetCount(iterations);

        final AtomicInteger counter = new AtomicInteger();
        ExecutorService executor = Executors.newScheduledThreadPool(iterations);
        for (int i = 0; i < iterations; i++) {
            executor.execute(new Runnable() {
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.