当前位置: 首页>>代码示例>>Java>>正文


Java ThreadPoolExecutor.isTerminated方法代码示例

本文整理汇总了Java中java.util.concurrent.ThreadPoolExecutor.isTerminated方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadPoolExecutor.isTerminated方法的具体用法?Java ThreadPoolExecutor.isTerminated怎么用?Java ThreadPoolExecutor.isTerminated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ThreadPoolExecutor的用法示例。


在下文中一共展示了ThreadPoolExecutor.isTerminated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: migrateData

import java.util.concurrent.ThreadPoolExecutor; //导入方法依赖的package包/类
private void migrateData() throws SQLException{
	executor =  new ThreadPoolExecutor(margs.getThreadCount(), margs.getThreadCount(),
               0L, TimeUnit.MILLISECONDS,
               new LinkedBlockingQueue<Runnable>(),new ThreadPoolExecutor.CallerRunsPolicy());
	for(TableMigrateInfo table:migrateTables){
		if(!table.isError()){ //忽略已出错的拆分表
			List<DataNodeMigrateInfo> detailList = table.getDataNodesDetail();
			for(DataNodeMigrateInfo info:detailList){
				executor.execute(new DataMigrateRunner(table, info.getSrc(), info.getTarget(), table.getTableName(), info.getTempFile()));
			}
		}
	}
	executor.shutdown();
	while(true){
		if(executor.isTerminated()){
			break;
		}
		try {
			Thread.sleep(200);
		} catch (InterruptedException e) {
			LOGGER.error("error",e);
		}
	}
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:25,代码来源:DataMigrator.java

示例2: run

import java.util.concurrent.ThreadPoolExecutor; //导入方法依赖的package包/类
/*******************
 * Enumeration mode main function.
 ******************/
public void run() {
	ThreadPoolExecutor tpe = (ThreadPoolExecutor)Executors.newFixedThreadPool(this._opts.getThreadCount());
	ArrayList<TCPEndpoint> targets = this._opts.getTargets();
	RMIEnumerator rmie = new RMIEnumerator(this._opts);
	
	//Initialise the list of known attacks with the current program options
	RMIAttackFactory.setProgramOptions(this._opts);
	
	//Status
	System.out.println("Scanning " + targets.size() + " target(s) for objects exposed via an RMI registry...");
	System.out.println("");
	
	//Pass all tasks to the thread pool executor
	for(TCPEndpoint t: targets) {
		tpe.execute(new EnumerationTask(t, rmie, this._opts));
	}
	
	//Shutdown the thread pool and wait for threads to finish executing
	tpe.shutdown();
	while(tpe.isTerminated() == false) { }
	
	//Done
	System.out.println("Successfully scanned " + targets.size() + " target(s) for objects exposed via RMI.");
	
	//Clean up all attacks (e.g. stop proxies that were started to enumerate endpoints)
	RMIAttackFactory.cleanUp();
}
 
开发者ID:NickstaDB,项目名称:BaRMIe,代码行数:31,代码来源:EnumerationMode.java

示例3: rejectedExecution

import java.util.concurrent.ThreadPoolExecutor; //导入方法依赖的package包/类
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
    if (!executor.isTerminated()) {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
        }
        r.run();
    }
}
 
开发者ID:farchanjo,项目名称:webcron,代码行数:10,代码来源:RejectExecutionImpl.java


注:本文中的java.util.concurrent.ThreadPoolExecutor.isTerminated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。