public String handleCommand ( final String command ) throws InterruptedException { if ( lock . tryLock ( 1 , TimeUnit . SECONDS ) ) { try { return doHandleCommand ( command ) ; } finally { lock . unlock ( ) ; } } return "'" + command + "' execution is timed out!" ; }
Runs a command on the console . Will not run exit quit shutdown their upper - case or mixed case counterparts .