用一个类类继承Thread,并实现run方法,在run方法中写相关实现逻辑
Future future = MyThreadPool.submit(qdt);
/**
* 等待各个线程任务完成
* @param futures
*/
@SuppressWarnings("rawtypes")
private void waitForThreads(List<Future> futures) {
if (futures != null) {
for (Future future : futures) {
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}