1 package peersim.rangesim;
6 * This thread is used to kill forked processes in the case of an abnormal
7 * termination of the Java virtual machine (for example, due to a signal).
9 public class ProcessManager extends Thread
12 /** The threads that must be killed */
13 private List<ProcessHandler> threads;
15 public ProcessManager()
17 threads = Collections.synchronizedList(new ArrayList<ProcessHandler>());
20 public void addThread(ProcessHandler p)
26 * Assumes that the process manager
31 while (i < threads.size()) {
33 threads.get(i).join();
35 } catch (InterruptedException e) {
42 * Kill the child process.
46 System.err.println("Terminating simulation.");
47 for (int i=0; i < threads.size(); i++) {
48 if (threads.get(i) != null)
49 threads.get(i).doStop();