void () { myProcessHandler.destroyProcess(); waitFor(myProcessHandler); if (!myProcessHandler.isProcessTerminated()) { if (!waitFor(myProcessHandler)) { if (!myProcessHandler.isProcessTerminated()) { throw new RuntimeException("Cannot stop console process"); } } } myProcessHandler = null; }