java.util.concurrent.LinkedBlockingDeque.takeLast()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中java.util.concurrent.LinkedBlockingDeque.takeLast()方法的一些代码示例,展示了LinkedBlockingDeque.takeLast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedBlockingDeque.takeLast()方法的具体详情如下:
包路径:java.util.concurrent.LinkedBlockingDeque
类名称:LinkedBlockingDeque
方法名:takeLast

LinkedBlockingDeque.takeLast介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

/**
 * Behaves as {@link LinkedBlockingQueue#take()}, except it will silently
 * skip all calls which it thinks should be dropped.
 *
 * @return the head of this queue
 * @throws InterruptedException if interrupted while waiting
 */
@Override
public CallRunner take() throws InterruptedException {
 CallRunner cr;
 while(true) {
  if (((double) queue.size() / this.maxCapacity) > lifoThreshold) {
   numLifoModeSwitches.increment();
   cr = queue.takeLast();
  } else {
   cr = queue.takeFirst();
  }
  if (needToDrop(cr)) {
   numGeneralCallsDropped.increment();
   cr.drop();
  } else {
   return cr;
  }
 }
}

代码示例来源:origin: numenta/htm.java

/**
 * Returns the item at the tail of this {@code Deque} or null
 * if it is empty. This call does not block if empty.
 * 
 * @return    item at the tail of this {@code Deque} or null
 *             if it is empty.
 */
public E tail() {
  E val = null;
  try {
    val = backingList.takeLast();
    currentSize--;
  }catch(Exception e) { e.printStackTrace(); }
  
  return val;
}

代码示例来源:origin: numenta/htm.java

/**
 * Returns the item at the tail of this {@code Deque} or null
 * if it is empty. This call does not block if empty.
 * 
 * @return    item at the tail of this {@code Deque} or null
 *             if it is empty.
 */
public E takeLast() {
  if(currentSize == 0) return null;
  
  E val = null;
  try {
    val = backingList.takeLast();
    currentSize--;
  }catch(Exception e) { e.printStackTrace(); }
  
  return val;
}

相关文章

微信公众号

最新文章

更多