當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。