Examples of reducePermits()


Examples of com.hazelcast.core.ISemaphore.reducePermits()

    }

    @Before
    public void start() throws IOException {
        ISemaphore s = getInstance().getSemaphore(name);
        s.reducePermits(100);
        assertEquals(0, s.availablePermits());
    }

    @After
    public void clear() throws IOException {
View Full Code Here

Examples of com.hazelcast.core.ISemaphore.reducePermits()

    }

    @After
    public void clear() throws IOException {
        ISemaphore s = getInstance().getSemaphore(name);
        s.reducePermits(100);
        assertEquals(0, s.availablePermits());
    }

    @Test
    public void testAcquire() throws Exception {
View Full Code Here

Examples of com.hazelcast.core.ISemaphore.reducePermits()

        int numberOfPermits = 20;

        assertTrue(semaphore.init(numberOfPermits));
        for (int i = 0; i < numberOfPermits; i += 5) {
            assertEquals(numberOfPermits - i, semaphore.availablePermits());
            semaphore.reducePermits(5);
        }

        assertEquals(semaphore.availablePermits(), 0);
    }
View Full Code Here

Examples of com.hazelcast.core.ISemaphore.reducePermits()

    @Test(timeout = 30000)
    public void testReduce_whenArgumentNegative() {
        final ISemaphore semaphore = hz.getSemaphore(randomString());
        try {
            semaphore.reducePermits(-5);
            fail();
        } catch (IllegalArgumentException expected) {
        }
        assertEquals(0, semaphore.availablePermits());
    }
View Full Code Here

Examples of com.hazelcast.core.ISemaphore.reducePermits()

    @Test
    public void testAvailableReducePermits_WhenZero() throws Exception {
        final ISemaphore semaphore = client.getSemaphore(randomString());
        semaphore.init(0);
        semaphore.reducePermits(1);
        assertEquals(0, semaphore.availablePermits());
    }

    @Test
    public void testTryAcquire_whenAvailable() throws Exception {
View Full Code Here

Examples of com.hazelcast.core.ISemaphore.reducePermits()

    @Test
    public void testAvailableReducePermits() throws Exception {
        final ISemaphore semaphore = client.getSemaphore(randomString());
        semaphore.init(10);
        semaphore.reducePermits(5);
        assertEquals(5, semaphore.availablePermits());
    }

    @Test
    public void testAvailableReducePermits_WhenZero() throws Exception {
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.