What is a process_reaper thread in Java?

倖福魔咒の 提交于 2020-12-01 07:10:19

问题


I'm getting hundreds of these process_reaper threads that build up over time in my application. Anyone have any idea what these may be? They seem to be in my use of Runtime.exec() however I'm destroying my process in a finally statement but they still show up

screen shot: http://www.dropmocks.com/mBxM5

Process proc = null;
        String line;
        try {
            logger.info("Trying to execute command " + Arrays.asList(command).toString().replace(",", ""));
            proc = Runtime.getRuntime().exec(command);

        } catch (IOException e) {
            logger.info("IOException while trying to execute " + command);
            return false;
        } finally {
            if(proc != null) {
                proc.destroy();
            }
    }

回答1:


I haven't seen this one myself so I searched a little; it seems a process reaper is related to the Linux kernel process management and is a daemon thread. It maintains the process state so that resources can be freed/released/collected on process termination and so on. This resource might help you. There is a mention on reapers in the final parts.




回答2:


you must call process.waitFor() after exec and before destory (asy action)



来源:https://stackoverflow.com/questions/3835830/what-is-a-process-reaper-thread-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!