本文整理汇总了Java中java.util.concurrent.LinkedBlockingDeque.poll方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedBlockingDeque.poll方法的具体用法?Java LinkedBlockingDeque.poll怎么用?Java LinkedBlockingDeque.poll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.LinkedBlockingDeque
的用法示例。
在下文中一共展示了LinkedBlockingDeque.poll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateTxnProfileTotals
import java.util.concurrent.LinkedBlockingDeque; //导入方法依赖的package包/类
private void calculateTxnProfileTotals(Procedure catalog_proc, long totals[]) {
long tuple[] = null;
LinkedBlockingDeque<long[]> queue = this.txn_profile_queues.get(catalog_proc);
while ((tuple = queue.poll()) != null) {
totals[0]++;
for (int i = 0, cnt = tuple.length; i < cnt; i++) {
totals[i+1] += tuple[i];
} // FOR
} // FOR
}
示例2: testDrainToN
import java.util.concurrent.LinkedBlockingDeque; //导入方法依赖的package包/类
/**
* drainTo(c, n) empties first min(n, size) elements of queue into c
*/
public void testDrainToN() {
LinkedBlockingDeque q = new LinkedBlockingDeque();
for (int i = 0; i < SIZE + 2; ++i) {
for (int j = 0; j < SIZE; j++)
assertTrue(q.offer(new Integer(j)));
ArrayList l = new ArrayList();
q.drainTo(l, i);
int k = (i < SIZE) ? i : SIZE;
assertEquals(k, l.size());
assertEquals(SIZE - k, q.size());
for (int j = 0; j < k; ++j)
assertEquals(l.get(j), new Integer(j));
do {} while (q.poll() != null);
}
}
示例3: testElement
import java.util.concurrent.LinkedBlockingDeque; //导入方法依赖的package包/类
/**
* element returns next element, or throws NSEE if empty
*/
public void testElement() {
LinkedBlockingDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertEquals(i, q.element());
q.poll();
}
try {
q.element();
shouldThrow();
} catch (NoSuchElementException success) {}
}
示例4: testContains
import java.util.concurrent.LinkedBlockingDeque; //导入方法依赖的package包/类
/**
* contains(x) reports true when elements added but not yet removed
*/
public void testContains() {
LinkedBlockingDeque q = populatedDeque(SIZE);
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.contains(new Integer(i)));
q.poll();
assertFalse(q.contains(new Integer(i)));
}
}