Java Code Examples for java.util.concurrent.BlockingQueue#element()

The following examples show how to use java.util.concurrent.BlockingQueue#element() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: disruptor   File: MPMCBlockingQueueTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testElement() {
    final int cap = 10;
    BlockingQueue<Integer> dbq = new MPMCBlockingQueue<>(cap);

    try {
        dbq.element();
        Assert.fail();
    } catch(NoSuchElementException ex) {
        // expected
    }
}
 
Example 2
@Test
public void testElement() {
    final int cap = 10;
    BlockingQueue<Integer> dbq = new DisruptorBlockingQueue<Integer>(cap);

    try {
        dbq.element();
        Assert.fail();
    } catch(NoSuchElementException ex) {
        // expected
    }
}
 
Example 3
@Test
public void testElement() {
    final int cap = 10;
    BlockingQueue<Integer> dbq = new PushPullBlockingQueue<Integer>(cap);

    try {
        dbq.element();
        Assert.fail();
    } catch(NoSuchElementException ex) {
        // expected
    }
}