Subject Re: Java Stored Procedures
Author Roman Rokytskyy
> Sure. The classloader loads stuff on demand. There is no way to
> force it to load all dependencies of a class.

Can you explain this a bit more? JVM specification requires the
implementation to follow the strict class initialization procedure.
Java applications rely on this late binding behavior. But that does
not mean that particular classloader cannot cache binary definitions
in memory to avoid disk access.

So, do you simply load .class files into memory from the disk, or do
you fully initialize the loaded classes before JVM asks you to do
this? If later, then this violates the JVM specification.

> How do you catch native calls back into the engine? I suppose you
> could put the whole thing, JVM and all, into a shared library and
> have a base class do a loadLibrary on itself, but that means that
> JVM can't be statically linked in. On refection, maybe that's a
> good thing.

In our case JVM is not statically bound but dynamically loaded using
shared library specified in the config. This allows us to load any
compliant JVM. And yes, the callback goes via
loadLibrary("javaespudf") which contains all needed entrypoints.