Patrick Luby <[EMAIL PROTECTED]> wrote:

> Pier,
> 
> Pier Fumagalli wrote:
>> 
>> 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...
> 
> I agree. I got your sample code to work on Mac OS X 10.1 and, just for kicks,
> had Java invoke the callback that was registered.

Save files, ./make.sh, ./testjni :)

> Since you have separated out the port binding into Tomcat->initialize(), you
> are
> also correct that I don't need to call the callback function from Java. I
> admit
> my thinking was still limited to the existing constraints of the
> StandardServer.start() method instead of the new bootstrap classes.

No, there should be a bootstrap already separating the entry points...

> Next thing I will do is take a look at the bootstrap classes and test out your
> recommendation.

Great :)

>> 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...
> 
> We used the JVM invocation API when I was working on StarOffice. However, I
> never ran into the RegisterNative method. Although we don't need it for the
> setuid() calls, I think it might come in handy sometime.

RegisterNatives is "gold", it's actually what it does at the end of
System.loadLibrary, going to analyze the exported functions from a DSO,
translating names, and calling it... See the JVM sources...

>> 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...
> 
> I admit that I kept expecting there to be more work to do. But you keep
> surprising me with what you have already implemented. Thanks for having the
> patience to walk me through this.

People were saying that I didn't do s*** while I was at Sun... I did
_something_, I just never had the chance to wrap it up (priorities were
changing from time to time)...

    Pier


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to