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

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

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

ForkJoinPool.getRunningThreadCount介绍

[英]Returns an estimate of the number of worker threads that are not blocked waiting to join tasks or for other managed synchronization. This method may overestimate the number of running threads.
[中]

代码示例

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

@ManagedAttribute(description="Current number of active threads in the thread pool")
public int getThreadPoolSizeActive() {
  if(thread_pool instanceof ThreadPoolExecutor)
    return ((ThreadPoolExecutor)thread_pool).getActiveCount();
  if(thread_pool instanceof ForkJoinPool)
    return ((ForkJoinPool)thread_pool).getRunningThreadCount();
  return 0;
}

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

@Override
  public Integer getValue() {
    return fjPool().getRunningThreadCount();
  }
});

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@ManagedAttribute(description="Current number of active threads in the thread pool")
public int getThreadPoolSizeActive() {
  if(thread_pool instanceof ThreadPoolExecutor)
    return ((ThreadPoolExecutor)thread_pool).getActiveCount();
  if(thread_pool instanceof ForkJoinPool)
    return ((ForkJoinPool)thread_pool).getRunningThreadCount();
  return 0;
}

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

@Override
public int getRunningThreadCount() {
  return fjPool().getRunningThreadCount();
}

代码示例来源:origin: coffeewar/enode-master

@Override
public int getRunningThreadCount() {
  return java.util.concurrent.ForkJoinPool.commonPool().getRunningThreadCount();
}

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

@Override
public ForkJoinInfo getInfo() {
  final ForkJoinPool fjPool = fjPool();
  int activeThreadCount = fjPool.getActiveThreadCount(); // Returns an estimate of the number of threads that are currently stealing or executing tasks.
  int runningThreadCount = fjPool.getRunningThreadCount(); // Returns an estimate of the number of worker threads that are not blocked waiting to join tasks or for other managed synchronization.
  int queuedSumbmissionCount = fjPool.getQueuedSubmissionCount(); // Returns an estimate of the number of tasks submitted to this pool that have not yet begun executing.
  long queuedTaskCount = fjPool.getQueuedTaskCount(); // Returns an estimate of the total number of tasks currently held in queues by worker threads (but not including tasks submitted to the pool that have not begun executing).
  long stealCount = fjPool.getStealCount(); //  Returns an estimate of the total number of tasks stolen from one thread's work queue by another.
  return new ForkJoinInfo(activeThreadCount, runningThreadCount, queuedSumbmissionCount, queuedTaskCount, stealCount);
}

代码示例来源:origin: stackoverflow.com

"counter=" + counter + "." + idx +
" activeThreads=" + pool.getActiveThreadCount() +
" runningThreads=" + pool.getRunningThreadCount() +
" poolSize=" + pool.getPoolSize() +
" queuedTasks=" + pool.getQueuedTaskCount() +

相关文章

ForkJoinPool类方法