Code example for TimeoutException

0
			p.waitFor(); 
		} catch (InterruptedException e) {
			// Stop the process from running 
			p.destroy(); 
			Thread.interrupted();	
			throw new TimeoutException(command + "did not return after " + timeout + " milliseconds");
		} finally { 
			// Stop the timer 
			timer.cancel();
		} 
 
 
	} 
 
	private class InterruptScheduler extends TimerTask {
		Thread target = null;
 
		public InterruptScheduler(Thread target) {
			this.target = target;
		}