Christian Heimes <li...@cheimes.de> wrote:

> Bill Janssen wrote:
> > I was thinking about this some more, and have an idea.  How about only
> > having the dictionary of the module init'ed by calling initVM?  That is,
> > it would be practically speaking impossible to call any other Java
> > method until the VM has been initialized and the thread attached.  The
> > overhead would go into "import", where it might be acceptable.  So
> > instead of getting the bus error, you'd get an AttributeError.
> 
> It's possible to have multiple packages that are warpped with JCC. You
> have to invoke initVM exactly once with the combined class path of every
> package. You have to add a way to tell a package that it has been
> initialized by initVM() of another package.

Yes...  Of course, it's possible to call initVM multiple times, once
with each CLASSPATH, for example, and perhaps that should be the
standard way to do it.  But even without doing that, the check made by
"import" could look to see if (1) the VM is initialized, and (2) the
classpath for the module being imported is on the JVM classpath.

"Attaching" a thread to the JVM could happen automatically this way,
too.  Calling initVM would attach the current thread; import with the VM
already init'ed would attach the importing thread.  And there would be
no methods to call in an unattached thread to cause a bus error.

Bill

Reply via email to