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

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

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

ForkJoinPool.commonSubmitterQueue介绍

[英]Returns common pool queue for a thread that has submitted at least one task.
[中]返回至少已提交一个任务的线程的公共池队列。

代码示例

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns an estimate of the number of tasks that have been
 * forked by the current worker thread but not yet executed. This
 * value may be useful for heuristic decisions about whether to
 * fork other tasks.
 *
 * @return the number of tasks
 */
public static int getQueuedTaskCount() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? 0 : q.queueSize();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

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

/**
 * Returns, but does not unschedule or execute, a task queued by
 * the current thread but not yet executed, if one is immediately
 * available. There is no guarantee that this task will actually
 * be polled or executed next. Conversely, this method may return
 * null even if a task exists but cannot be accessed without
 * contention with other threads.  This method is designed
 * primarily to support extensions, and is unlikely to be useful
 * otherwise.
 *
 * @return the next task, or {@code null} if none are available
 */
protected static ForkJoinTask<?> peekNextLocalTask() {
  Thread t; ForkJoinPool.WorkQueue q;
  if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
    q = ((ForkJoinWorkerThread)t).workQueue;
  else
    q = ForkJoinPool.commonSubmitterQueue();
  return (q == null) ? null : q.peek();
}

相关文章

ForkJoinPool类方法