threadhelper.java
来自「利用多线程从搜索引擎下载网页并提取数据到数据库。」· Java 代码 · 共 40 行
JAVA
40 行
import java.util.List;
public class ThreadHelper implements Runnable {
int tc;
List<Thread> threads;
List<ProfileDL> instances;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public void run() {
exitThreads();
}
public ThreadHelper(int tc,List<Thread> threads, List<ProfileDL> instances)
{
this.tc=tc;
this.threads=threads;
this.instances=instances;
}
private void exitThreads() {
int i;
for (i = 0; i < tc; i++) {
if (threads.get(i).isAlive()) {
instances.get(i).exit(threads.get(i).getName());
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?