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

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(85)

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

ForkJoinPool.nextTaskFor介绍

[英]Gets and removes a local or stolen task for the given worker.
[中]获取并删除给定辅助进程的本地或被盗任务。

代码示例

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

代码示例来源:origin: hm.binkley/binkley-util

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

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

/**
 * If the current thread is operating in a ForkJoinPool,
 * unschedules and returns, without executing, the next task
 * queued by the current thread but not yet executed, if one is
 * available, or if not available, a task that was forked by some
 * other thread, if available. Availability may be transient, so a
 * {@code null} result does not necessarily imply quiescence of
 * the pool this task is operating in.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return a task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> pollTask() {
  Thread t; ForkJoinWorkerThread wt;
  return ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
    (wt = (ForkJoinWorkerThread)t).pool.nextTaskFor(wt.workQueue) :
    null;
}

相关文章

微信公众号

最新文章

更多

ForkJoinPool类方法