-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mladen,
On 6/17/2011 1:21 AM, Mladen Turk wrote: > On 06/17/2011 12:14 AM, Christopher Schultz wrote: >> >> On 6/16/2011 5:03 PM, Francis GALIEGUE wrote: >>> >>> I was actually wondering about these. I think I have my answer now :/ >>> Solutions in C or other languages are many to achieve that, Java has >>> none. >> >> Correct: native code has to be written. tc-native notwithstanding, the >> Tomcat team doesn't like to work with native code too much, and I can >> understand why: it's a total minefield. Different OS versions, different >> architectures, different c-library discrepancies, etc. > > There ARE tomcat developers that are quite fun of C code and > regularly participate in various "native" projects, so this > has nothing to do with that. I wasn't trying to suggest that there was any fear of native code... just that it's really only used when necessary (APR, for instance). >> Even if someone wrote something like this in native code, the result >> would be essentially a fork() call which would clone your JVM, which >> isn't going to be a fast process at that late stage of the game (in JVM >> time, that is). > > Exactly, and the fork() doesn't work with JVM. fork() only forks the > single thread, so all your monitor, GC, memory threads are not there. > For JVM, fork() is only valid if followed by execv which is basically > what Runtime.exec does. Yes, but the "daemon" function calls fork() and then the /parent/ exist, which would ruin everything. I don't believe there's another way to drop in to the background after a process is launched like that. > Also there is a question of portability. Windows doesn't have fork(). Yup. There are ways of making it work, but it's just another way for native code to bite you in the butt. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk3+rZMACgkQ9CaO5/Lv0PDPBgCdG2Q2reBf9ipIy6KYFQ0fqwrm e8MAnjcgLSM9IxmePdf5OQPT+LU4MUVW =6KNG -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
