全部展开
那么,通过多线程处理要做的事情62616964757 a 686964616 Fe 59 B9 ee7ad 943133365653165,可以简单地处理如下的package com.Wen xy.test.Baidu.zhidadu
importjava.util.Iterator;
import Java.util.concurrent.executor;
import Java.util.concurrent.executors;
publicclassTestLoop{
公共静态inti=0;
voiddoSomething () }
system.out.println (thread.current thread () ).getName ) )。
' isdoing '。 andi=' i;
I;
}
publicstaticvoidmain (字符串[ ] args ) {
finaltestlooptestloop=new test loop (;
//创建线程池,由10个线程处理
executor executor=executors.newfixedthreadpool (10;
for(inti=0; I
executor.execute(newrunnable ) )。
@Override
公共语音运行(}
testLoop.doSomething (;
}
);
}
}
}