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

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

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

ForkJoinPool.isQuiescent介绍

[英]Returns true if all worker threads are currently idle. An idle worker is one that cannot obtain a task to execute because none are available to steal from other threads, and there are no pending submissions to the pool. This method is conservative; it might not return true immediately upon idleness of all threads, but will eventually become true if threads remain inactive.
[中]如果所有工作线程当前处于空闲状态,则返回true。空闲工作线程是无法获得要执行的任务的工作线程,因为没有可从其他线程窃取的任务,并且没有挂起的对池的提交。这种方法是保守的;它可能不会在所有线程空闲时立即返回true,但如果线程保持非活动状态,它最终将变为true。

代码示例

代码示例来源:origin: co.paralleluniverse/quasar-core

@Override
  public Status getValue() {
    final ForkJoinPool fjPool = fjPool();
    if (fjPool.isTerminated()) // Returns true if all tasks have completed following shut down.
      return ForkJoinPoolMonitor.Status.TERMINATED;
    if (fjPool.isTerminating()) // Returns true if the process of termination has commenced but not yet completed.
      return ForkJoinPoolMonitor.Status.TERMINATING;
    if (fjPool.isShutdown()) // Returns true if this pool has been shut down.
      return ForkJoinPoolMonitor.Status.SHUTDOWN;
    if (fjPool.isQuiescent()) // Returns true if all worker threads are currently idle.
      return ForkJoinPoolMonitor.Status.QUIESCENT;
    return ForkJoinPoolMonitor.Status.ACTIVE;
  }
});

代码示例来源:origin: co.paralleluniverse/quasar-core

@Override
public ForkJoinPoolMonitor.Status getStatus() {
  final ForkJoinPool fjPool = fjPool();
  if (fjPool.isTerminated()) // Returns true if all tasks have completed following shut down.
    return ForkJoinPoolMonitor.Status.TERMINATED;
  if (fjPool.isTerminating()) // Returns true if the process of termination has commenced but not yet completed.
    return ForkJoinPoolMonitor.Status.TERMINATING;
  if (fjPool.isShutdown()) // Returns true if this pool has been shut down.
    return ForkJoinPoolMonitor.Status.SHUTDOWN;
  if (fjPool.isQuiescent()) // Returns true if all worker threads are currently idle.
    return ForkJoinPoolMonitor.Status.QUIESCENT;
  return ForkJoinPoolMonitor.Status.ACTIVE;
}

代码示例来源:origin: cmu-phil/tetrad

while (!pool.isQuiescent()) {

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

p.addActiveCount(-1);
if (p.isQuiescent()) {
  p.addActiveCount(1);
  p.addQuiescerCount(-1);

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

p.addActiveCount(-1);
if (p.isQuiescent()) {
  p.addActiveCount(1);
  p.addQuiescerCount(-1);

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

p.addActiveCount(-1);
if (p.isQuiescent()) {
  p.addActiveCount(1);
  p.addQuiescerCount(-1);

相关文章

ForkJoinPool类方法