本文整理了Java中java.util.concurrent.ThreadPoolExecutor.isTerminated()
方法的一些代码示例,展示了ThreadPoolExecutor.isTerminated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPoolExecutor.isTerminated()
方法的具体详情如下:
包路径:java.util.concurrent.ThreadPoolExecutor
类名称:ThreadPoolExecutor
方法名:isTerminated
暂无
代码示例来源:origin: aa112901/remusic
public static boolean isTerminated(){
return mInstance.mThreadPoolExec.isTerminated();
}
代码示例来源:origin: jmxtrans/jmxtrans
@Override
public boolean isTerminated() {
return executor.isTerminated();
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void close() throws Exception {
processor.shutdown();
processor.awaitTermination(shutdownWaitMS,TimeUnit.MILLISECONDS);
if (!processor.isTerminated()) {
//log.error("Processor did not terminate in time");
processor.shutdownNow();
}
}
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public void close() throws Exception {
processor.shutdown();
processor.awaitTermination(SHUTDOWN_WAIT_MS,TimeUnit.MILLISECONDS);
if (!processor.isTerminated()) {
//log.error("Processor did not terminate in time");
processor.shutdownNow();
}
}
}
代码示例来源:origin: apache/geode
@Override
public boolean isTerminated() {
return super.isTerminated() && timer.isTerminated();
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
String msg = String.format("Thread pool is EXHAUSTED!" +
" Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," +
" Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!",
threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(),
e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(),
url.getProtocol(), url.getIp(), url.getPort());
logger.warn(msg);
dumpJStack();
throw new RejectedExecutionException(msg);
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
String msg = String.format("Thread pool is EXHAUSTED!" +
" Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," +
" Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!",
threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(),
e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(),
url.getProtocol(), url.getIp(), url.getPort());
logger.warn(msg);
dumpJStack();
throw new RejectedExecutionException(msg);
}
代码示例来源:origin: vipshop/vjtools
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
String msg = String.format(
"Thread pool is EXHAUSTED!"
+ " Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d),"
+ " Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s)!",
threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(),
e.getLargestPoolSize(), e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(),
e.isTerminating());
logger.warn(msg);
dummper.tryThreadDump(null);
throw new RejectedExecutionException(msg);
}
代码示例来源:origin: apache/hbase
@Override
protected void doStop() {
disconnect(); // don't call super.doStop()
if (this.conn != null) {
try {
this.conn.close();
this.conn = null;
} catch (IOException e) {
LOG.warn("Failed to close the connection");
}
}
// Allow currently running replication tasks to finish
exec.shutdown();
try {
exec.awaitTermination(maxTerminationWait, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
}
// Abort if the tasks did not terminate in time
if (!exec.isTerminated()) {
String errMsg = "HBaseInterClusterReplicationEndpoint termination failed. The " +
"ThreadPoolExecutor failed to finish all tasks within " + maxTerminationWait + "ms. " +
"Aborting to prevent Replication from deadlocking. See HBASE-16081.";
abortable.abort(errMsg, new IOException(errMsg));
}
notifyStopped();
}
代码示例来源:origin: geoserver/geoserver
if (!executor.isTerminated()) {
executor.shutdownNow();
代码示例来源:origin: briandilley/jsonrpc4j
private void waitForServerToTerminate() throws InterruptedException {
if (!executor.isTerminated()) {
executor.awaitTermination(2000 + SERVER_SOCKET_SO_TIMEOUT, TimeUnit.MILLISECONDS);
}
}
代码示例来源:origin: didi/DoraemonKit
/**
* 初始化ThreadPoolExecutor
* 双重检查加锁,只有在第一次实例化的时候才启用同步机制,提高了性能
*/
private void initThreadPoolExecutor() {
if (mExecutor == null || mExecutor.isShutdown() || mExecutor.isTerminated()) {
synchronized (ThreadPoolProxy.class) {
if (mExecutor == null || mExecutor.isShutdown() || mExecutor.isTerminated()) {
long keepAliveTime = 3000;
TimeUnit unit = TimeUnit.MILLISECONDS;
BlockingQueue workQueue = new LinkedBlockingDeque<>();
ThreadFactory threadFactory = Executors.defaultThreadFactory();
RejectedExecutionHandler handler = new ThreadPoolExecutor.DiscardPolicy();
mExecutor = new ThreadPoolExecutor(mCorePoolSize, mMaximumPoolSize, keepAliveTime, unit, workQueue,
threadFactory, handler);
}
}
}
}
/**
代码示例来源:origin: wycm/zhihu-crawler
public void run(){
while(!isStopMonitor){
logger.debug(name +
String.format("[monitor] [%d/%d] Active: %d, Completed: %d, queueSize: %d, Task: %d, isShutdown: %s, isTerminated: %s",
this.executor.getPoolSize(),
this.executor.getCorePoolSize(),
this.executor.getActiveCount(),
this.executor.getCompletedTaskCount(),
this.executor.getQueue().size(),
this.executor.getTaskCount(),
this.executor.isShutdown(),
this.executor.isTerminated()));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
logger.error("InterruptedException",e);
}
}
}
}
代码示例来源:origin: javahongxi/whatsmars
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
String msg = String.format("Thread pool is EXHAUSTED!" +
" Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," +
" Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!",
threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(),
e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(),
url.getProtocol(), url.getIp(), url.getPort());
logger.warn(msg);
dumpJStack();
throw new RejectedExecutionException(msg);
}
代码示例来源:origin: wycm/zhihu-crawler
detailListPageThreadPool.shutdown();
if(detailListPageThreadPool.isTerminated()){
代码示例来源:origin: io.airlift/concurrent
@Managed
public boolean isTerminated()
{
return threadPoolExecutor.isTerminated();
}
代码示例来源:origin: com.opentable.components/otj-executors
@Override
@ManagedAttribute
public boolean isTerminated()
{
return service.isTerminated();
}
代码示例来源:origin: linux-china/dubbo3
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
String msg = String.format("Thread pool is EXHAUSTED!" +
" Thread Name: %s, Pool Size: %d (active: %d, core: %d, max: %d, largest: %d), Task: %d (completed: %d)," +
" Executor status:(isShutdown:%s, isTerminated:%s, isTerminating:%s), in %s://%s:%d!" ,
threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(),
e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(),
url.getProtocol(), url.getIp(), url.getPort());
logger.warn(msg);
throw new RejectedExecutionException(msg);
}
代码示例来源:origin: org.apache.mahout/mahout-core
public synchronized void reset() {
for (int x = 0; x < numTopics; x++) {
topicTermCounts.assignRow(x, new SequentialAccessSparseVector(numTerms));
}
topicSums.assign(1.0);
if (threadPool.isTerminated()) {
initializeThreadPool();
}
}
代码示例来源:origin: org.apache.mahout/mahout-mr
public synchronized void reset() {
for (int x = 0; x < numTopics; x++) {
topicTermCounts.assignRow(x, new SequentialAccessSparseVector(numTerms));
}
topicSums.assign(1.0);
if (threadPool.isTerminated()) {
initializeThreadPool();
}
}
内容来源于网络,如有侵权,请联系作者删除!