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

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

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

LinkedBlockingDeque.linkFirst介绍

[英]Links node as first element, or returns false if full.
[中]链接节点作为第一个元素,如果已满则返回false。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: robovm/robovm

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: robovm/robovm

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public boolean offerFirst(E e, long timeout, TimeUnit unit)
  throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  long nanos = unit.toNanos(timeout);
  final ReentrantLock lock = this.lock;
  lock.lockInterruptibly();
  try {
    while (!linkFirst(node)) {
      if (nanos <= 0)
        return false;
      nanos = notFull.awaitNanos(nanos);
    }
    return true;
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * @throws NullPointerException {@inheritDoc}
 */
public boolean offerFirst(E e) {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    return linkFirst(node);
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putFirst(E e) throws InterruptedException {
  if (e == null) throw new NullPointerException();
  Node<E> node = new Node<E>(e);
  final ReentrantLock lock = this.lock;
  lock.lock();
  try {
    while (!linkFirst(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

相关文章

微信公众号

最新文章

更多