org.apache.commons.exec.Executor.getWatchdog()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.apache.commons.exec.Executor.getWatchdog()方法的一些代码示例,展示了Executor.getWatchdog()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.getWatchdog()方法的具体详情如下:
包路径:org.apache.commons.exec.Executor
类名称:Executor
方法名:getWatchdog

Executor.getWatchdog介绍

[英]Get the watchdog used to kill of processes running, typically, too long time.
[中]让看门狗来杀死运行时间过长的进程。

代码示例

代码示例来源:origin: eirslett/frontend-maven-plugin

private int execute(final Logger logger, final OutputStream stdout, final OutputStream stderr)
    throws ProcessExecutionException {
  logger.debug("Executing command line {}", commandLine);
  try {
    ExecuteStreamHandler streamHandler = new PumpStreamHandler(stdout, stderr);
    executor.setStreamHandler(streamHandler);
    int exitValue = executor.execute(commandLine, environment);
    logger.debug("Exit value {}", exitValue);
    return exitValue;
  } catch (ExecuteException e) {
    if (executor.getWatchdog() != null && executor.getWatchdog().killedProcess()) {
      throw new ProcessExecutionException("Process killed after timeout");
    }
    throw new ProcessExecutionException(e);
  } catch (IOException e) {
    throw new ProcessExecutionException(e);
  }
}

代码示例来源:origin: bbonnin/zeppelin-mongodb-interpreter

private void stopProcess(String paragraphId) {
 if (runningProcesses.containsKey(paragraphId)) {
  final Executor executor = runningProcesses.get(paragraphId);
  final ExecuteWatchdog watchdog = executor.getWatchdog();
  watchdog.destroyProcess();
 }
}

代码示例来源:origin: georocket/georocket

/**
  * Stop a running Elasticsearch instance
  */
 public void stop() {
  if (executor != null && !stopped) {
   stopped = true;
   executor.getWatchdog().destroyProcess();
  }
 }
}

代码示例来源:origin: jFastCGI/jfastcgi

public void destroy() {
  if (processExecutor != null) {
    processExecutor.getWatchdog().destroyProcess();
    processExecutor = null;
  }
}

相关文章