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

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

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

LinkedBlockingQueue.unlink介绍

[英]Unlinks interior Node p with predecessor trail.
[中]

代码示例

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

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

/**
 * Removes a single instance of the specified element from this queue,
 * if it is present.  More formally, removes an element {@code e} such
 * that {@code o.equals(e)}, if this queue contains one or more such
 * elements.
 * Returns {@code true} if this queue contained the specified element
 * (or equivalently, if this queue changed as a result of the call).
 *
 * @param o element to be removed from this queue, if present
 * @return {@code true} if this queue changed as a result of the call
 */
public boolean remove(Object o) {
  if (o == null) return false;
  fullyLock();
  try {
    for (Node<E> trail = head, p = trail.next;
       p != null;
       trail = p, p = p.next) {
      if (o.equals(p.item)) {
        unlink(p, trail);
        return true;
      }
    }
    return false;
  } finally {
    fullyUnlock();
  }
}

相关文章

微信公众号

最新文章

更多