使用线程池在多个线程中运行静态方法的最佳方式是什么? 另外我试图将一个参数传递给静态方法。像从java中的线程池运行静态方法
Class A{
public static runTask(int i){
....
}
}
,并从主:
ThreadPool pool = new ThreadPool(5, "poolname");
for(int i=1; i<10; i++){
A.runTask(i) // but on a new thread...
}
谢谢!
我希望你不打算使用可变静态字段。 – 2010-11-23 11:15:49