harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Chernyshev" <a.y.chernys...@gmail.com>
Subject [classlib] Is it OK for VM kernel class to call internal classlib API?
Date Tue, 04 Jul 2006 18:07:42 GMT
I was trying to compile the kernel classes set from DRLVM independently
from the classlib and found it difficult because kernel classes set
currently have a dependence on the internal classlib API, e.g.
and org.apache.harmony.luni.util.DeleteOnExit classes.

I've found the spec for kernel class org.apache.harmony.kernel.vm.VM
(l'm looking at
assumes that VM is calling excplicitly JarURLConnection.closeCachedFiles()
and DeleteOnExit.deleteOnExit() during VM shutdown.

On the other hand, there is standard API in J2SE called
java.lang.Runtime.addShutdownHook(Thread) which can be used to specify
tasks that have to be done during VM shutdown.
BTW, this is exactly how DRLVM implements these methods in it's
VM.java. For example, for VM.closeJars() it currently does like:

public static void closeJars() {
     class CloseJarsHook implements Runnable {
     public void run() {
        Runtime.getRuntime().addShutdownHook(new Thread(new CloseJarsHook()));

Are there any problems with this approach, should the DRLVM (or other
Vm's) implement these methods differently?

May be it makes sense just to move VM.closeJars() and
VM.deleteOnExit() methods and their drlvm implementation to the luni
classlib component, under assumption that they do not really contain
any VM-specific code?
I guess it will simplify a bit the org.apache.harmony.kernel.vm.VM
interface as well as would allow to avoid extra dependencies between
VM and classlib.

Andrey Chernyshev
Intel Middleware Products Division

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