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

The following examples show how to use java.util.concurrent.BlockingQueue#element() . 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 File: MPMCBlockingQueueTest.java    From disruptor with 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
Source File: DisruptorBlockingQueueTest.java    From disruptor with Apache License 2.0 5 votes vote down vote up
@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
Source File: PushPullBlockingQueueTest.java    From disruptor with Apache License 2.0 5 votes vote down vote up
@Test
public void testElement() {
    final int cap = 10;
    BlockingQueue<Integer> dbq = new PushPullBlockingQueue<Integer>(cap);

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