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

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

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

LinkedBlockingDeque.linkLast介绍

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

代码示例

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

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

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public boolean offerLast(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 (!linkLast(node)) {
      if (nanos <= 0)
        return false;
      nanos = notFull.awaitNanos(nanos);
    }
    return true;
  } finally {
    lock.unlock();
  }
}

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

/**
 * Creates a {@code LinkedBlockingDeque} with a capacity of
 * {@link Integer#MAX_VALUE}, initially containing the elements of
 * the given collection, added in traversal order of the
 * collection's iterator.
 *
 * @param c the collection of elements to initially contain
 * @throws NullPointerException if the specified collection or any
 *         of its elements are null
 */
public LinkedBlockingDeque(Collection<? extends E> c) {
  this(Integer.MAX_VALUE);
  final ReentrantLock lock = this.lock;
  lock.lock(); // Never contended, but necessary for visibility
  try {
    for (E e : c) {
      if (e == null)
        throw new NullPointerException();
      if (!linkLast(new Node<E>(e)))
        throw new IllegalStateException("Deque full");
    }
  } finally {
    lock.unlock();
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

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

/**
 * @throws NullPointerException {@inheritDoc}
 * @throws InterruptedException {@inheritDoc}
 */
public void putLast(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 (!linkLast(node))
      notFull.await();
  } finally {
    lock.unlock();
  }
}

相关文章

微信公众号

最新文章

更多