如何在没有其他人建议的情况下不使用ProcessBuilder.
我有三个类 – PingParallel是我的主类,PingTask是每个线程执行的任务,PingResult是结果代码(我们还可以添加更多信息,状态消息等).
PingParallel
package com.test.thread;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class PingParallel {
public static void main(String[] args) {
int totalIps = 89;
ExecutorService executor = Executors.newFixedThreadPool(totalIps);
List> list = new ArrayList>();
Callable callable = null;
for(int i=0; i< totalIps; i++){
callable = new PingTask("127.0.0"+i); // Get the ipAddres buttons[i].getText());
Future f