Java Code Examples for java.util.concurrent.ConcurrentLinkedDeque#addLast()
The following examples show how to use
java.util.concurrent.ConcurrentLinkedDeque#addLast() .
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: ConcurrentLinkedDequeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * addLast(null) throws NPE */ public void testAddLastNull() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); try { q.addLast(null); shouldThrow(); } catch (NullPointerException success) {} }
Example 2
Source File: ConcurrentLinkedDequeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * addLast(x) succeeds */ public void testAddLast() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addLast(zero); q.addLast(one); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); }
Example 3
Source File: WrongOrderTransporter.java From moleculer-java with MIT License | 5 votes |
@Override public void publish(String channel, Tree message) { HashSet<ConcurrentLinkedDeque<Tree>> queues = new HashSet<>(); synchronized (channels) { for (Map.Entry<String, ConcurrentLinkedDeque<Tree>> entry : channels.entrySet()) { String test = entry.getKey(); if (test.endsWith(':' + channel)) { queues.add(entry.getValue()); } } } for (ConcurrentLinkedDeque<Tree> queue : queues) { queue.addLast(message); } }
Example 4
Source File: ConcurrentLinkedDequeTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * addLast(null) throws NPE */ public void testAddLastNull() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); try { q.addLast(null); shouldThrow(); } catch (NullPointerException success) {} }
Example 5
Source File: ConcurrentLinkedDequeTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * addLast(x) succeeds */ public void testAddLast() { ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(); q.addLast(zero); q.addLast(one); assertSame(zero, q.peekFirst()); assertSame(one, q.peekLast()); }