1

I have a Java server application that handles low level network data processing running on a Linux kernel. I also have two restrictions:

  • Native code for data processing
  • Hitless upgrade of the Java application (no loss of data)

The solution I came up with is to have a separate native process for the network data and control it from the Java server through some kind of IPC, like Named Pipes. I am now looking for the best option to start this process in the first place.

I could compile it as a native executable code and run it as an external process Runtime.exec(), however, I'm not sure that the process will keep running if the JVM is killed and that is what I need.

Is there a way to have the native code compiled as a shared object, accessible through JNI and start the process from Java or from native context in a posix thread or something and have it still running when Java is killed?

Thanks!

rhobincu
  • 906
  • 1
  • 7
  • 22
  • 1
    Possible duplicate:http://stackoverflow.com/questions/931536/how-do-i-launch-a-completely-independent-process-from-a-java-program – Cratylus Dec 01 '13 at 14:32
  • This question is not specific to Java or JNI. – Robin Green Dec 01 '13 at 17:25
  • @Cratylus: Thanks, that tells me that I can start a process with `Runtime.exec()` and it will still run after the JVM is terminted. It doesn't answer my second question though: Can I start the process in C, through a JNI call and make sure it still runs after the JVM is terminated? – rhobincu Dec 01 '13 at 21:42
  • @rhobincu:When you start a new process, it all comes down whether your java process is the parent process of the forked process or not.If it is then once the java process dies then your c process will be an "orphan" process and killed by the OS.But if you read the answers in the link I posted in my previous comment, it seems that the parent process is not your java process. – Cratylus Dec 08 '13 at 21:17

0 Answers0