Java and security bits

Thursday Jun 28, 2007

Source Code for the OpenJDK Modules Project

We just posted the first source drop of the OpenJDK Modules project on the project page. The Modules project covers the implementation of JSR 277 and JSR 294 and you now have a chance to get a really early look at it, try it out, and contribute to it.

If you want to know what it is all about and how it works, please read the docs on the project page, in particular the samples and the getting started pages. As the samples show, it is really easy to create and run a Module, even from a remote web server. It is fast too:

% time java -repository http://openjdk.java.net/projects/modules/samplerepo/ -module dep
Module 'dep' calling module 'hello'...
Hello world from module hello 1.0
0.34u 0.18s 0:00.81 64.1%
In other words, it takes less than a second to start the Java VM, download 2 minimal modules from a remote web server, and execute them [1]. (This is on a three year old Opteron 248 running Solaris; Java warm in the page cache) Note the disclaimer about untrusted code at the bottom of the samples page, though.

In general, I am really happy with the size and complexity (or lack thereof) of the JSR 277 implementation. The code that I call the core of the implementation - module initialization and class loading - is less than 1200 lines of code (see src/share/classes/sun/module/core). And that includes the big GPL copyright headers in all the files. Of course the implementation is not complete and will grow somewhat, but it already handles module initialization, including optional dependencies and reexport, versioning, dependency cycles, custom import policies, shallow validation, etc. In other words, all the core features.

Then we have the mailing lists:

If you are interested in the conversations of the developers working on the Modules project, in discussions about how to use JSR 277 and 294, or if you want to actively contribute, I encourage you to join.

Now time for a few random notes:

  • this is a live development snapshot. It is not a beta. Nothing is complete and polished.

  • it is source code for developers. No binaries at this time.

  • not much of the JSR 294 implementation is included, because not much exists so far. This will change.

  • the way to get the source is by downloading a ZIP file that includes all source code in the j2se workspace. That's why it is 68 MB, not because the Modules implementation is that large. We expect to get something more convenient - such as a Mercurial repository - before too long.

  • all the new code in the Modules project is under the GPLv2 (plus classpath exception).

  • regression and unit tests are included. More about that in a future post.

  • before there is any confusion, the 1 second startup time does not mean we have made any fundamental changes to the JRE, that is done by another project. What the Modules sample program shows is just how fast Java is when you run small and efficient applications and systems.

Comments:

Yeah but 1 second is still bit awkward for xargs on hundreds of files. But then again it's probably not something that java even tries to be useful in.

Posted by Betelgeuse on June 28, 2007 at 01:40 AM PDT #

[Trackback] We have just made an early snapshot of the JSR 277 and JSR 294 implementation available through the Modules project on openjdk.

Posted by Stanley Ho's Blog on June 28, 2007 at 03:37 AM PDT #

@Betelgeuse: granted, but I'm guessing that some local caching would reduce that. It depends of course on how much of that 1s is taken up by which action :-)

Posted by Stephmw on June 28, 2007 at 03:41 AM PDT #

Andreas,

congratulations on this milestone! I wouldn't have bragged about executing "Hello World" in 0.34 seconds. It shows that the Java platform has horrible startup performance. I hope that Sun will set the bar higher for the Java Kernel project.

It would have been more interesting to see a non-modularized version of "Hello World" compared to the version you demoed.

Posted by Peter Ahé on June 28, 2007 at 08:15 AM PDT #

How soon is this likely to be integrated with the ongoing jdk7 builds? Or released in a standalone binary version? I want to write an article for java.net about modules, but I don't want to have to ask my readers to build it from source code!

Posted by David Flanagan on July 03, 2007 at 01:08 PM PDT #

Post a Comment:
Comments are closed for this entry.

Calendar

Feeds

Links

Recent Posts

Referers