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

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

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

ForkJoinPool.work介绍

[英]Top-level loop for worker threads: On each step: if the previous step swept through all queues and found no tasks, or there are excess threads, then possibly blocks. Otherwise, scans for and, if found, executes a task. Returns when pool and/or worker terminate.
[中]工作线程的顶级循环:在每一步上:如果上一步扫描了所有队列,没有发现任务,或者有多余的线程,那么可能会阻塞。否则,扫描并执行任务(如果找到)。当池和/或工作线程终止时返回。

代码示例

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

/**
 * This method is required to be public, but should never be
 * called explicitly. It performs the main run loop to execute
 * {@link ForkJoinTask}s.
 */
public void run() {
  Throwable exception = null;
  try {
    onStart();
    pool.work(this);
  } catch (Throwable ex) {
    exception = ex;
  } finally {
    onTermination(exception);
  }
}

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

/**
 * This method is required to be public, but should never be
 * called explicitly. It performs the main run loop to execute
 * {@link ForkJoinTask}s.
 */
public void run() {
  Throwable exception = null;
  try {
    onStart();
    pool.work(this);
  } catch (Throwable ex) {
    exception = ex;
  } finally {
    onTermination(exception);
  }
}

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

/**
 * This method is required to be public, but should never be
 * called explicitly. It performs the main run loop to execute
 * {@link ForkJoinTask}s.
 */
public void run() {
  Throwable exception = null;
  try {
    onStart();
    pool.work(this);
  } catch (Throwable ex) {
    exception = ex;
  } finally {
    onTermination(exception);
  }
}

相关文章

微信公众号

最新文章

更多

ForkJoinPool类方法