Module change detection...

Bryan Atsatt bryan.atsatt at
Tue Aug 12 16:22:56 PDT 2008

There are a number of class loading optimizations (including HotSpot's 
Class Data Sharing) that are hard to make generic due to the lack of a 
standard way to validate cached class state. We have a unique 
opportunity to fix this in 277...

I propose that we add:

1. An annotation to record a digest over the module's contents, which 
would then be visible from ModuleInfo.
2. A convenience api to return the digest, e.g.:

    public interface ModuleContent {
        public byte[] getDigest();

The jam tool would compute and add the annotation, and the default 
implementation(s) of ModuleContent would then just return the value from 
the annotation.

Other implementations would be free to compute the value at install time 
(or even runtime); development environments could "generate" a value 
using a simple counter.

Unlike the version number, this value can be used to ensure that any 
change to the module's contents can be detected. Both HotSpot and other 
JVMs can then introduce optimizations like Class Data Sharing that 
depend on being able to validate the cache file.

It may similarly be useful to have ModuleInfo be able to (lazily) 
compute a digest for itself, and/or have a digest on ModuleDefinition 
that encompasses both the metadata (ModuleInfo) and the contents.

// Bryan

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the jsr277-eg-observer mailing list