Search in sources :

Example 21 with LocalConcurrentBlockingObjectQueue

use of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue in project HugeCollections-OLD by peter-lawrey.

the class LocalJSR166TestCase method testIteratorOrdering.

/**
     * iterator ordering is FIFO
     */
@Test
public void testIteratorOrdering() {
    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());
    }
    assertEquals(3, k);
}
Also used : BlockingQueue(java.util.concurrent.BlockingQueue) LocalConcurrentBlockingObjectQueue(net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue) Test(org.junit.Test)

Aggregations

BlockingQueue (java.util.concurrent.BlockingQueue)21 LocalConcurrentBlockingObjectQueue (net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue)21 Test (org.junit.Test)20 Ignore (org.junit.Ignore)5 CountDownLatch (java.util.concurrent.CountDownLatch)3 ExecutorService (java.util.concurrent.ExecutorService)2