@Override
    public void destroy() throws ManagedProcessException {
        //
        // if destroy() is ever giving any trouble, the org.openqa.selenium.os.ProcessUtils may be
        // of
        // interest
        //
        if (!isAlive) {
            throw new ManagedProcessException(getProcLongName()
                    + " was already stopped (or never started)");
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Going to destroy {}", getProcLongName());
        }

        watchDog.destroyProcess();

        try {
            // Safer to waitFor() after destroy()
            resultHandler.waitFor();
        } catch (InterruptedException e) {
            throw handleInterruptedException(e);
        }

        if (logger.isInfoEnabled()) {
            logger.info("Successfully destroyed {}", getProcLongName());
        }

        isAlive = false;
    }
@ Override public void destroy ( ) throws ManagedProcessException { if ( ! isAlive ) { throw new ManagedProcessException ( getProcLongName ( ) + " was already stopped (or never started)" ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Going to destroy {}" , getProcLongName ( ) ) ; } watchDog . destroyProcess ( ) ; try { resultHandler . waitFor ( ) ; } catch ( InterruptedException e ) { throw handleInterruptedException ( e ) ; } if ( logger . isInfoEnabled ( ) ) { logger . info ( "Successfully destroyed {}" , getProcLongName ( ) ) ; } isAlive = false ; }
Kills the Process. If you expect that the process may not be running anymore, use if (
{@link #isAlive()}) around this. If you expect that the process should still be running at
this point, call as is - and it will tell if it had nothing to destroy.

@throws ManagedProcessException if the Process is already stopped (either because destroy()
already explicitly called, or it terminated by itself, or it was never started)