static boolean waitFor(Process process,long timeout) throws InterruptedException {
  final int interval=1000 * 1;
  long timeWaiting=0;
  while (timeWaiting < timeout) {
    if (!isProcessAlive(process))     return true;
    if (_logger.isDebugEnabled())     _logger.debug("Process is still alive [" + process + "] time to wait ["+ (timeout - timeWaiting)+ "ms], timeout ["+ timeout+ "]ms");
    try {
      Thread.sleep(interval);
    }
 catch (    InterruptedException e) {
      e.fillInStackTrace();
      throw e;
    }
    timeWaiting+=interval;
  }
  return false;
}

static boolean waitFor ( Process process , long timeout ) throws InterruptedException { final int interval = 1000 * 1 ; long timeWaiting = 0 ; while ( timeWaiting < timeout ) { if ( ! isProcessAlive ( process ) ) return true ; if ( _logger . isDebugEnabled ( ) ) _logger . debug ( "Process is still alive [" + process + "] time to wait [" + ( timeout - timeWaiting ) + "ms], timeout [" + timeout + "]ms" ) ; try { Thread . sleep ( interval ) ; } catch ( InterruptedException e ) { e . fillInStackTrace ( ) ; throw e ; } timeWaiting += interval ; } return false ; }
allows the caller to wait for the completion of the process , but no longer than a given timeout value .
