private synchronized void handleWatchdog(){
  final int exitCode;
  if (watchdog == null)   return;
  if (watchdogTimeout == 0)   return;
  if (!isRunning()) {
    exitCode=OnCommandResultListener.SHELL_DIED;
    Debug.log(String.format("[%s%%] SHELL_DIED",shell.toUpperCase(Locale.ENGLISH)));
  }
 else   if (watchdogCount++ < watchdogTimeout) {
    return;
  }
 else {
    exitCode=OnCommandResultListener.WATCHDOG_EXIT;
    Debug.log(String.format("[%s%%] WATCHDOG_EXIT",shell.toUpperCase(Locale.ENGLISH)));
  }
  if (handler != null) {
    postCallback(command,exitCode,buffer);
  }
  command=null;
  buffer=null;
  idle=true;
  watchdog.shutdown();
  watchdog=null;
  kill();
}

private synchronized void handleWatchdog ( ) { final int exitCode ; if ( watchdog == null ) return ; if ( watchdogTimeout == 0 ) return ; if ( ! isRunning ( ) ) { exitCode = OnCommandResultListener . SHELL_DIED ; Debug . log ( String . format ( "[%s%%] SHELL_DIED" , shell . toUpperCase ( Locale . ENGLISH ) ) ) ; } else if ( watchdogCount ++ < watchdogTimeout ) { return ; } else { exitCode = OnCommandResultListener . WATCHDOG_EXIT ; Debug . log ( String . format ( "[%s%%] WATCHDOG_EXIT" , shell . toUpperCase ( Locale . ENGLISH ) ) ) ; } if ( handler != null ) { postCallback ( command , exitCode , buffer ) ; } command = null ; buffer = null ; idle = true ; watchdog . shutdown ( ) ; watchdog = null ; kill ( ) ; }
called from a scheduledthreadpoolexecutor timer thread every second when there is an outstanding command
