本文整理了Java中java.util.concurrent.ForkJoinPool.work()
方法的一些代码示例,展示了ForkJoinPool.work()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ForkJoinPool.work()
方法的具体详情如下:
包路径:java.util.concurrent.ForkJoinPool
类名称: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!