Patrick Luby <[EMAIL PROTECTED]> wrote: > Pier, > > I took a quick look at the code and found the RegisterNative function. This > looks like an interesting feature. I also found the same function in your > daemons code. The picture is becoming much clearer.
Well, RegisterNative is there since at least 4 years... Kinda hard to do some callbacks without it.... > Let me try to get it working in the next few days with the callback function > set > to invoke setuid() and have the callback invoke (via Java reflection since it > won't be there on Windows or standalone start. IMO, it's a waste of time... You shouldn't call setuid from Java, but the native code launching the VM should call appropriate methods at appropriate moments of the lifecycle... As I said before: 1) CreateJavaVM 2) call Tomcat->initialize() (bind to ports) 3) set uid/euid/gid/egid/groups 4) call Tomcat->start() (accept connections) 5) wait for signal 6) call Tomcat->stop() 7) exit process... All the code is already in place... Just need to be tied together... > If I can get this to work, I will post the patches first so that all can > inspect. Now that I understand this approach, it basically seems to work > through > the same logical steps (from a Tomcat Java code) perspective as invoking the > callback function via JNI. RegisterNative _is_ JNI... JNI is developed on two layers, call C from Java (maybe using System.loadLibrary()), and that's what everyone knows. Call Java from C (a little bit less known, but way more powerful)... We need a JVM invocation API, not a Java callback mechanism, IMO... > In your approach, the function is preloaded for Java (no System.loadLibrary() > required) and the Java code invokes the function like any other method (it > just happens that the method doesn't exist at compile time but only at > runtime). That's the beauty of JNI, you can do things that you won't even believe they exist, like "compiling" (loading) a class when NOT all its methods are there... It's the beauty of a Class seen as an Instance of an object (and IMO the biggest advantage over things like SmallTalk)... JG thought it out good... Pier -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>