# Re: URGENT Question: JNI, Security, and multiple instances

Sheng Liang (sl@Eng)
Mon, 12 Jan 1998 11:45:05 -0800

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Dan Ascheman: "generating keys"
- Previous message: Jan Luehe: "Re: JCE 1.2"

    Date: Mon, 12 Jan 1998 11:45:05 -0800

    From: Sheng Liang <sl@Eng>

    To: Alec Muffett <Alec.Muffett@UK>

    Subject: Re: URGENT Question: JNI, Security, and multiple instances

Alec Muffett wrote:

> I would like to ask:
>
> * Can I dynamically load and utilise native methods in "foo/libthing.so"
> for one thread inside a JVM, and also concurrently load and utilise
> the (same) methods from "bar/libthing.so", for a separate thread
> running a separate ClassLoader?

Yes you can. You need to keep in mind, however, that you are dealing
with multiple names spaces in different class loaders. A class named
"A" in one class loader is not the same as a class named "A" in another
class loader. You need to be especially careful with JNI global refs.
Similarly, a JNI method ID derived from a class in one loader cannot
be used with a class with the same name in another loader.

> This is a side-effect of the way the "java.library.path" property is
> managed; the Runtime object for the JVM maintains a array of "paths"
> for finding native libraries, which (once initialised) cannot be changed.
>
> Alas, this is inadequate for our purposes; we need to be able to load/define
> native methods with the same flexibility as we do Java-methods.
>
> Can you advise?

This is on the list of improvements to consider for 1.2 FCS.

Sheng Liang

- Next message: Dan Ascheman: "generating keys"
- Previous message: Jan Luehe: "Re: JCE 1.2"