本文整理了Java中java.util.concurrent.ThreadPoolExecutor.runStateAtLeast()
方法的一些代码示例,展示了ThreadPoolExecutor.runStateAtLeast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPoolExecutor.runStateAtLeast()
方法的具体详情如下:
包路径:java.util.concurrent.ThreadPoolExecutor
类名称:ThreadPoolExecutor
方法名:runStateAtLeast
暂无
代码示例来源:origin: robovm/robovm
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: robovm/robovm
/**
* Returns the current number of threads in the pool.
*
* @return the number of threads
*/
public int getPoolSize() {
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
// Remove rare and surprising possibility of
// isTerminated() && getPoolSize() > 0
return runStateAtLeast(ctl.get(), TIDYING) ? 0
: workers.size();
} finally {
mainLock.unlock();
}
}
代码示例来源:origin: robovm/robovm
public boolean awaitTermination(long timeout, TimeUnit unit)
throws InterruptedException {
long nanos = unit.toNanos(timeout);
final ReentrantLock mainLock = this.mainLock;
mainLock.lock();
try {
for (;;) {
if (runStateAtLeast(ctl.get(), TERMINATED))
return true;
if (nanos <= 0)
return false;
nanos = termination.awaitNanos(nanos);
}
} finally {
mainLock.unlock();
}
}
代码示例来源:origin: robovm/robovm
/**
* Transitions runState to given target, or leaves it alone if
* already at least the given target.
*
* @param targetState the desired state, either SHUTDOWN or STOP
* (but not TIDYING or TERMINATED -- use tryTerminate for that)
*/
private void advanceRunState(int targetState) {
for (;;) {
int c = ctl.get();
if (runStateAtLeast(c, targetState) ||
ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
break;
}
}
代码示例来源:origin: robovm/robovm
(runStateAtLeast(c, TERMINATED) ? "Terminated" :
"Shutting down"));
return super.toString() +
代码示例来源:origin: robovm/robovm
int c = ctl.get();
if (isRunning(c) ||
runStateAtLeast(c, TIDYING) ||
(runStateOf(c) == SHUTDOWN && ! workQueue.isEmpty()))
return;
代码示例来源:origin: robovm/robovm
if ((runStateAtLeast(ctl.get(), STOP) ||
(Thread.interrupted() &&
runStateAtLeast(ctl.get(), STOP))) &&
!wt.isInterrupted())
wt.interrupt();
代码示例来源:origin: MobiVM/robovm
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: com.gluonhq/robovm-rt
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: ibinti/bugvm
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: jtulach/bck2brwsr
public boolean isTerminated() {
return runStateAtLeast(ctl.get(), TERMINATED);
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* Ensures that unless the pool is stopping, the current thread
* does not have its interrupt set. This requires a double-check
* of state in case the interrupt was cleared concurrently with a
* shutdownNow -- if so, the interrupt is re-enabled.
*/
private void clearInterruptsForTaskRun() {
if (runStateLessThan(ctl.get(), STOP) &&
Thread.interrupted() &&
runStateAtLeast(ctl.get(), STOP))
Thread.currentThread().interrupt();
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Ensures that unless the pool is stopping, the current thread
* does not have its interrupt set. This requires a double-check
* of state in case the interrupt was cleared concurrently with a
* shutdownNow -- if so, the interrupt is re-enabled.
*/
private void clearInterruptsForTaskRun() {
if (runStateLessThan(ctl.get(), STOP) &&
Thread.interrupted() &&
runStateAtLeast(ctl.get(), STOP))
Thread.currentThread().interrupt();
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* Ensures that unless the pool is stopping, the current thread
* does not have its interrupt set. This requires a double-check
* of state in case the interrupt was cleared concurrently with a
* shutdownNow -- if so, the interrupt is re-enabled.
*/
private void clearInterruptsForTaskRun() {
if (runStateLessThan(ctl.get(), STOP) &&
Thread.interrupted() &&
runStateAtLeast(ctl.get(), STOP))
Thread.currentThread().interrupt();
}
代码示例来源:origin: ibinti/bugvm
/**
* Transitions runState to given target, or leaves it alone if
* already at least the given target.
*
* @param targetState the desired state, either SHUTDOWN or STOP
* (but not TIDYING or TERMINATED -- use tryTerminate for that)
*/
private void advanceRunState(int targetState) {
for (;;) {
int c = ctl.get();
if (runStateAtLeast(c, targetState) ||
ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
break;
}
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* Transitions runState to given target, or leaves it alone if
* already at least the given target.
*
* @param targetState the desired state, either SHUTDOWN or STOP
* (but not TIDYING or TERMINATED -- use tryTerminate for that)
*/
private void advanceRunState(int targetState) {
for (;;) {
int c = ctl.get();
if (runStateAtLeast(c, targetState) ||
ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
break;
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Transitions runState to given target, or leaves it alone if
* already at least the given target.
*
* @param targetState the desired state, either SHUTDOWN or STOP
* (but not TIDYING or TERMINATED -- use tryTerminate for that)
*/
private void advanceRunState(int targetState) {
for (;;) {
int c = ctl.get();
if (runStateAtLeast(c, targetState) ||
ctl.compareAndSet(c, ctlOf(targetState, workerCountOf(c))))
break;
}
}
内容来源于网络,如有侵权,请联系作者删除!