harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject [general] Multiple VMs running in a single process
Date Tue, 26 Sep 2006 17:20:14 GMT
We should bear in mind that applications may create multiple VM
instances per process, i.e. by calling JNI_CreateJavaVM multiple times,
and may choose to run the same classlib code on different VM instances

In addition, applications are not obliged to exit the process after
destroying VMs to make them clean up <g>; so a couple of design points
to remember are:

- using global/static variables in native code is not a good idea unless
you intended the value to be shared across all VM instances.
The VMI has functions to set/get VM-local storage (VMLS) variables[1]
whose scope is a single VM instance. There is an example of their usage
here [2].

- when the VM is being destroyed it should free any resources it
allocated in the OS.  Similarly the class library code should release
any resources on shutdown.  Java code can use shutdownhooks to get
notification of exit, if there is any need for further native level
shutdown notification we can look at putting that into the VMI too.




Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message