进程异常终止 我在ubuntu下运行一个java程序,这个程序中开了一个子进程去运行另外一个东东,但有时子进程会异常结束,子进程异常结束时被父进程打印返回值139或者134,请问这两个返回值分别代表什么意思?????????????进程异常终止 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你一个 Java 启动进程,根据退出码判断是否成功执行你分配业务逻辑的例子: int ffmpegExitValue = 0; Process process = null; String ffmpegCmdLine = GlobalConstant.RTP_FFMPEG_PATH + " -re -i udp://" + localAddress + ":" + udpServerPort + "?localport=" + ffmpegUdpPort + " -f flv rtmp://" + localAddress + "/live/" + deviceId + channelName; log.debug("FfmpegThread----udpServerPort=" + udpServerPort + ";ffmpegUdpPort=" + ffmpegUdpPort + ";ffmpegCmdLine=" + ffmpegCmdLine); try { process = Runtime.getRuntime().exec(new String[]{"sh", "-c", ffmpegCmdLine}); StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR"); errorGobbler.start();// kick off stderr StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT"); outGobbler.start();// kick off stdout doneSignal.countDown();//ffmpeg 已经启动 process.waitFor();//等待该进程结束 ffmpegExitValue = process.exitValue(); log.debug("ffmpegCmdLine exitValue:" + ffmpegExitValue); if (process != null) { process.destroy(); log.debug("FfmpegThread,process destroyed...."); } } catch (IOException e1) { log.error(e1.getMessage(), e1); throw new BaseException(GlobalConstant.ERROR_CODE_40004);//TODO 自定义 error } catch (InterruptedException e) { log.error(e.getMessage(), e); throw new BaseException(GlobalConstant.ERROR_CODE_40004);//TODO 自定义 error } finally { if (ffmpegExitValue != 0) { log.debug("________________________FfmpegThread.is.not.normal termination.going to delete ffmpeg"); liveService.deleteFfmpegProcess(deviceId, channelName);// 根据 deviceId 删除 ffmpeg 数据库记录 } } struts2 action为什么无法获取到参数 想请教大家 关于培训的事 怎样在windows下调用Linux中的webservice? struts验证求助 怎么在struts里验证“确认密码” SPRING,HIBERNATE,QUARTZ,WEBWORK集成持久任务出现的问题 HTML?? Tomcat 与 eclipse整合问题 DOM分析的问题,请教各位师兄? 急等给分!!!! 怎样在websphere中发布我的jsp程序? mysql存放大量图片是否会导致速度急剧下降? 求大神帮忙,如何根据关键字爬取网站上的图片?
int ffmpegExitValue = 0;
Process process = null;
String ffmpegCmdLine = GlobalConstant.RTP_FFMPEG_PATH + " -re -i udp://" +
localAddress + ":" + udpServerPort +
"?localport=" + ffmpegUdpPort + " -f flv rtmp://" + localAddress + "/live/" + deviceId + channelName;
log.debug("FfmpegThread----udpServerPort=" + udpServerPort + ";ffmpegUdpPort=" + ffmpegUdpPort +
";ffmpegCmdLine=" + ffmpegCmdLine);
try {
process = Runtime.getRuntime().exec(new String[]{"sh", "-c", ffmpegCmdLine});
StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
errorGobbler.start();// kick off stderr
StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");
outGobbler.start();// kick off stdout
doneSignal.countDown();//ffmpeg 已经启动
process.waitFor();//等待该进程结束
ffmpegExitValue = process.exitValue();
log.debug("ffmpegCmdLine exitValue:" + ffmpegExitValue);
if (process != null) {
process.destroy();
log.debug("FfmpegThread,process destroyed....");
}
} catch (IOException e1) {
log.error(e1.getMessage(), e1);
throw new BaseException(GlobalConstant.ERROR_CODE_40004);//TODO 自定义 error
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
throw new BaseException(GlobalConstant.ERROR_CODE_40004);//TODO 自定义 error
} finally {
if (ffmpegExitValue != 0) {
log.debug("________________________FfmpegThread.is.not.normal termination.going to delete ffmpeg");
liveService.deleteFfmpegProcess(deviceId, channelName);// 根据 deviceId 删除 ffmpeg 数据库记录
}
}