Examples of remainingCapacity()


Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        try {
            BlockingQueue q = new LocalConcurrentBlockingObjectQueue(SIZE);
            for (int i = 0; i < SIZE; ++i) {
                assertTrue(q.add(new Integer(i)));
            }
            assertEquals(0, q.remainingCapacity());
            q.add(new Integer(SIZE));
            shouldThrow();
        } catch (IllegalStateException success) {
        }
    }
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        for (int i = 0; i < SIZE; ++i) {
            Integer I = new Integer(i);
            q.put(I);
            assertTrue(q.contains(I));
        }
        assertEquals(0, q.remainingCapacity());
    }

    /**
     * put blocks interruptibly if full
     */
 
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        Thread t = newStartedThread(new CheckedRunnable() {
            public void realRun() throws InterruptedException {
                for (int i = 0; i < SIZE; ++i)
                    q.put(i);
                assertEquals(SIZE, q.size());
                assertEquals(0, q.remainingCapacity());

                Thread.currentThread().interrupt();
                try {
                    q.put(99);
                    shouldThrow();
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        await(pleaseInterrupt);
        assertThreadStaysAlive(t);
        t.interrupt();
        awaitTermination(t);
        assertEquals(SIZE, q.size());
        assertEquals(0, q.remainingCapacity());
    }

    /**
     * put blocks interruptibly waiting for take when full
     */
 
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

                assertFalse(Thread.interrupted());
            }
        });

        await(pleaseTake);
        assertEquals(0, q.remainingCapacity());
        assertEquals(0, q.take());

        await(pleaseInterrupt);
        assertThreadStaysAlive(t);
        t.interrupt();
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        await(pleaseInterrupt);
        assertThreadStaysAlive(t);
        t.interrupt();
        awaitTermination(t);
        assertEquals(0, q.remainingCapacity());
    }

    /**
     * timed offer times out if full and elements not taken
     */
 
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        final BlockingQueue q = new LocalConcurrentBlockingObjectQueue(3);
        q.add(one);
        q.add(two);
        q.add(three);

        assertEquals("queue should be full", 0, q.remainingCapacity());

        int k = 0;
        for (Iterator it = q.iterator(); it.hasNext(); ) {
            assertEquals(++k, it.next());
        }
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        executor.execute(new CheckedRunnable() {
            public void realRun() throws InterruptedException {
                assertFalse(q.offer(three));
                threadsStarted.await();
                assertTrue(q.offer(three, LONG_DELAY_MS, MILLISECONDS));
                assertEquals(0, q.remainingCapacity());
            }
        });

        executor.execute(new CheckedRunnable() {
            public void realRun() throws InterruptedException {
View Full Code Here

Examples of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue.remainingCapacity()

        });

        executor.execute(new CheckedRunnable() {
            public void realRun() throws InterruptedException {
                threadsStarted.await();
                assertEquals(0, q.remainingCapacity());
                assertSame(one, q.take());
            }
        });

        joinPool(executor);
View Full Code Here

Examples of net.rubyeye.xmemcached.transcoders.CachedData.remainingCapacity()

        }
      case DATA:
        final CachedData value = this.returnValues
            .get(this.currentReturnKey);
        int remaining = buffer.remaining();
        int remainingCapacity = value.remainingCapacity();
        assert (remainingCapacity >= 0);
        // Data is not enough,return false
        if (remaining < remainingCapacity + 2) {
          int length = remaining > remainingCapacity ? remainingCapacity
              : remaining;
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.