1 4 package com.tc; 5 6 10 11 public class ProcessMonitor extends Thread { 12 private Process m_process; 13 private ProcessTerminationListener m_terminationListener; 14 15 public ProcessMonitor(Process process, 16 ProcessTerminationListener terminationListener) 17 { 18 super(); 19 20 m_process = process; 21 m_terminationListener = terminationListener; 22 23 start(); 24 } 25 26 public void run() { 27 while(true) { 28 try { 29 m_process.waitFor(); 30 m_terminationListener.processTerminated(m_process.exitValue()); 31 return; 32 } catch(InterruptedException ie) {} 33 } 34 } 35 } 36 | Popular Tags |