本文整理了Java中java.util.concurrent.ForkJoinPool.isTerminated()
方法的一些代码示例,展示了ForkJoinPool.isTerminated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ForkJoinPool.isTerminated()
方法的具体详情如下:
包路径:java.util.concurrent.ForkJoinPool
类名称:ForkJoinPool
方法名:isTerminated
[英]Returns true if all tasks have completed following shut down.
[中]如果关闭后所有任务都已完成,则返回true。
代码示例来源:origin: robovm/robovm
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: MobiVM/robovm
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: ibinti/bugvm
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Blocks until all tasks have completed execution after a shutdown
* request, or the timeout occurs, or the current thread is
* interrupted, whichever happens first.
*
* @param timeout the maximum time to wait
* @param unit the time unit of the timeout argument
* @return {@code true} if this executor terminated and
* {@code false} if the timeout elapsed before termination
* @throws InterruptedException if interrupted while waiting
*/
public boolean awaitTermination(long timeout, TimeUnit unit)
throws InterruptedException {
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.submissionLock;
lock.lock();
try {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0)
return false;
nanos = termination.awaitNanos(nanos);
}
} finally {
lock.unlock();
}
}
代码示例来源:origin: FlexoVM/flexovm
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: com.gluonhq/robovm-rt
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: jtulach/bck2brwsr
/**
* Blocks until all tasks have completed execution after a shutdown
* request, or the timeout occurs, or the current thread is
* interrupted, whichever happens first.
*
* @param timeout the maximum time to wait
* @param unit the time unit of the timeout argument
* @return {@code true} if this executor terminated and
* {@code false} if the timeout elapsed before termination
* @throws InterruptedException if interrupted while waiting
*/
public boolean awaitTermination(long timeout, TimeUnit unit)
throws InterruptedException {
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.submissionLock;
lock.lock();
try {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0)
return false;
nanos = termination.awaitNanos(nanos);
}
} finally {
lock.unlock();
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
throws InterruptedException {
long nanos = unit.toNanos(timeout);
if (isTerminated())
return true;
if (nanos <= 0L)
synchronized (this) {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0L)
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* Blocks until all tasks have completed execution after a shutdown
* request, or the timeout occurs, or the current thread is
* interrupted, whichever happens first.
*
* @param timeout the maximum time to wait
* @param unit the time unit of the timeout argument
* @return {@code true} if this executor terminated and
* {@code false} if the timeout elapsed before termination
* @throws InterruptedException if interrupted while waiting
*/
public boolean awaitTermination(long timeout, TimeUnit unit)
throws InterruptedException {
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.submissionLock;
lock.lock();
try {
for (;;) {
if (isTerminated())
return true;
if (nanos <= 0)
return false;
nanos = termination.awaitNanos(nanos);
}
} finally {
lock.unlock();
}
}
代码示例来源: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: 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;
}
});
内容来源于网络,如有侵权,请联系作者删除!