Java Code Examples for java.util.concurrent.LinkedBlockingDeque#pollLast()
The following examples show how to use
java.util.concurrent.LinkedBlockingDeque#pollLast() .
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: LinkedBlockingDequeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * peekFirst returns element inserted with addFirst */ public void testAddFirst() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.addFirst(four); assertSame(four, q.peekFirst()); }
Example 2
Source File: LinkedBlockingDequeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * peekLast returns element inserted with addLast */ public void testAddLast() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.addLast(four); assertSame(four, q.peekLast()); }
Example 3
Source File: LinkedBlockingDequeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * peekFirst returns element inserted with push */ public void testPushWithPeek() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.push(four); assertSame(four, q.peekFirst()); }
Example 4
Source File: TaskCache.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { if (!e.isShutdown()) { LinkedBlockingDeque<Runnable> deque = (LinkedBlockingDeque) e.getQueue(); Runnable runnable = deque.pollLast(); if (runnable instanceof DownloadFutureTask) { DownloadFutureTask futureTask = (DownloadFutureTask) runnable; futureTask.cancel(true); String url = futureTask.getUrl(); removeDownloadTask(url, futureTask); } e.execute(r); } }
Example 5
Source File: LinkedBlockingDequeTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * peekFirst returns element inserted with addFirst */ public void testAddFirst() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.addFirst(four); assertSame(four, q.peekFirst()); }
Example 6
Source File: LinkedBlockingDequeTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * peekLast returns element inserted with addLast */ public void testAddLast() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.addLast(four); assertSame(four, q.peekLast()); }
Example 7
Source File: LinkedBlockingDequeTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * peekFirst returns element inserted with push */ public void testPushWithPeek() { LinkedBlockingDeque q = populatedDeque(3); q.pollLast(); q.push(four); assertSame(four, q.peekFirst()); }
Example 8
Source File: TaskCache.java From iBeebo with GNU General Public License v3.0 | 5 votes |
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { if (!e.isShutdown()) { LinkedBlockingDeque<Runnable> deque = (LinkedBlockingDeque) e.getQueue(); Runnable runnable = deque.pollLast(); if (runnable instanceof DownloadFutureTask) { DownloadFutureTask futureTask = (DownloadFutureTask) runnable; futureTask.cancel(true); String url = futureTask.getUrl(); removeDownloadTask(url, futureTask); } e.execute(r); } }